For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
I created a code to save all information in datagriedview1 when I close my application but it doesn't work. Could you help me to find my error?
Public text As DataGridView
EndClassPrivateSub Button1_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles Button1.Click
EndSubPrivateSub Button2_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles Button2.Click
Dim DataGridView1 As DataView
Dim Col AsIntegerDim ran AsIntegerDim contacttable AsNew List(OfString)
Dim f As IO.FileStream = File.Create("enregistreContact.bin")
Dim text AsNew BinaryFormatter
TryFor Ran = 0To DataGridView1.Count - 1For Col = 0To2
text = DataGridView1.Item(Col, Ran).Value
Catch File As Exception
MsgBox("You must write a text!")
You should be storing all of your data in a suitable data stricture, NOT directly in the DGV. Once you have the data in a data structure, you set the DataSource of the DGV to the data structure. It also makes it MUCH easier to save the data structure to a file than the DGV.
You data structure can be a List<t>, a DataSet, a DataTable, some custom collection, ... whatever. Just don't use the DGV to "store" data. Controls are there to show a visual representation of data and edit that data, not to store it.
I work on a program that must capture the printout of a DOS application, filter its contents and send them to another printer.
Monitoring the print queue, I can detect the print job, but I need to take the name of the .spl file that contains the data to print or some way to take its content.
I use the PrintSystemJobInfo object but:
The JobStream property has a NULL value
Neither the JobName property nor the Name property point to the name of the file that contains the data.
(I have read the code of the PrinterQueueWatch project published in the articles, but it is too complex)
This is my first post in the forum.
I appreciate the help
I'm working on a subtitle editing program... I was wondering if there are other sdk's to play media files rather than the wmp.dll s. The wmp.dll doesn't support text overlaying in front of the video. Is there any other media player sdk to overlay text in front of the video playback?
Thank You I'll try it! But usually the video is rendered by the gpu in front of the window right? So if a window is kept in front of this gpu overlay will it be visible? The gpu always overlay it in front of everything right?
I found this vb transcripten of the codeproject article mentioned below.
However sometimes I would like to see the whole picture in the ImageViewer.
For this I would have to set the autoscroll to false and the sizemode property of
the embedded imagebox to "stretch".
Do I have to create another property in ImageViewer to change the sizemode to
Normal, StretchImage, AutoSize, CenterImage, Zoom
I am afraid this is beyond my level. Could someone help?
'based on http://www.codeproject.com/KB/linq/ScrollablePicturebox.aspxDim innerPicture AsNew PictureBox()
Dim mPictureFile AsString = String.Empty
Dim mAutoScroll AsBoolean = TrueSubNew()
' add the inner picture
innerPicture.Top = 0
innerPicture.Left = 0
innerPicture.SizeMode = PictureBoxSizeMode.Normal
EndSubPublicProperty PictureFile() AsStringGetReturn mPictureFile
mPictureFile = value
If (String.IsNullOrEmpty(mPictureFile) = False) Then' set the image to the image file
innerPicture.Image = Image.FromFile(mPictureFile)
' resize the image to match the image file
innerPicture.Size = innerPicture.Image.Size
innerPicture.Image = NothingEndIfEndSetEndPropertyPublicOverridesProperty AutoScroll AsBooleanGetReturn mAutoScroll
mAutoScroll = value
I'm trying to figure out the way to overwrite the existing content of the text file after found the specific word. The example content of text file as below. I'm looking the example in VB.Net to overwrite the words after the "No = " and "ID = ".
Name = MyName
No = 12345678
ID = 2000S1-DD7-8TA
Home = SD-PS-D1
Thanks for the guidance, however, I still unable make the code work as below. Appreciate if you could show the example.
MyProfile_File = "C\MyProfile\MyProfile.txt"
Dim MyProfile_StreamReader As New StreamReader(MyProfile_File)
Dim MyProfile_Content As String
MyProfile_Content = MyProfile_StreamReader.ReadToEnd
Dim MyProfile_StreamWriter As New StreamWriter(MyProfile_File, True)
Dim a As String()
a = Split(MyProfile_Content, vbCrLf)
Dim sFix As String
For i As Integer = 0 To a.Length - 1
sFix = a(i)
If a(i).IndexOf("ID = ") >= 0 Then
sFix = sFix.Replace(a(i).IndexOf("ID = ") + 1, "1122334")