converting problem from VB6 to B NET 2005.
converting problem from VB6 to B NET 2005..
I have this code;
VB Code:
Private Sub List1_DoubleClick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles List1.DoubleClick
Dim fileName As String
If List1.Items.Count > 0 Then
'UPGRADE_WARNING: Dir has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
fileName = Dir(My.Application.Info.DirectoryPath & "\words\" & VB6.GetItemString(List1, List1.SelectedIndex) & "\")
List2.Items.Clear()
Do
If fileName = "" Then
Exit Do
Else
List2.Items.Insert(List2.Items.Count, fileName)
'UPGRADE_WARNING: Dir has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
fileName = Dir()
End If
Loop
Randomize()
List2.SelectedIndex = Rnd() * (List2.Items.Count - 1)
Text1.Text = VB6.GetItemString(List2, List2.SelectedIndex)
List2.Items.RemoveAt((List2.SelectedIndex))
End If
End Sub
and I got this message as it seen here :
'UPGRADE_WARNING: Dir has a new behavior
I dont know how to fix this problem but:
I have a txt file and two words each sentence , and the program should display one word from a sentence randomly in a textbox and the user has two write the answer and if it good he will get a point in a labeltext if not a point in no good labeltext. suppose to be very simple but in VB 6 I have done it very good and now in NET 2005 have some problem can anyone can help me in such a code made in VB NET 2005 another thing that it should be in the code the whole the words from the txt file should be load into a list box at form load and after an answer made by the user , the word deleted from the listbox and the user can see the ramaining words in it.
please help me with this code or just give me a start of code that I could get the first value of a text and second one and random them ..
I want to make my dictation program as I already made by VB6
thanks in advance...
Re: converting problem from VB6 to B NET 2005.
Just remove the Dir call and use the Listbox .SelectedItem property in order to get the value that is selected...
VB Code:
Dim Filename As String = My.Application.Info.DirectoryPath & "\words\" & ListBox1.SelectedItem.ToString & "\"
MessageBox.Show(Filename)
Re: converting problem from VB6 to B NET 2005.
Although it may seem like a huge task, it is sometimes far easy to rebuild your projects from scratch when you upgrade from VB 6.
Re: converting problem from VB6 to B NET 2005.
Indeed its a huge task to do so:
So please I have a question for you-
I need just a little code in vb net 2005 to begin my application (it will give me a good start so please help...
I have a text file (words.txt) , and there I have a lot of sentences with two words each one, I just want a code which will pick randomly one sentence and display the result in 2 textboxes I have in the application,
it is realy dont complicate in VB6 but I need this code in VB NET 2005
please it would be very helpfull!!!!! :) ;) ;) ;) ;)
Re: converting problem from VB6 to B NET 2005.
Just look up StreamReader in this forum, you should pull several examples, as reading text from a file is a common question. In particular, the .ReadLine method is used to read a line of text, then its just a matter of splitting the string or using some other sort of string manipulation in order to display the two different values in the line...
Alternatively, you can read the entire file one time into a string array, and then just access the string array in order to display or manipulate the line you want, so you dont have to read the file each time you wish to display something...