can u convert this code?

hakari

Member
Joined
Nov 29, 2003
Messages
7
can you convert this from VB6 to .net form? i have no clue what to change?

Private Sub img1_click()
Dim ifilenum As Integer
ifilenum = FreeFile
Open App.Path & "\myfile.txt" For Output As ifilenum
Print #ifilenum, Txt1.Text
Print #ifilenum, txt2.Text
Close ifilenum
End Sub


Private Sub lblsign_Click()
Dim ifilenum As Integer
ifilenum = FreeFile
Open App.Path & "\myfile.txt" For Output As ifilenum
Print #ifilenum, Txt1.Text
Print #ifilenum, txt2.Text
Close ifilenum
MsgBox "WAHAHAHA testing!.", vbCritical, "WARNING!"
End Sub
 
Whenever you have Visual Basic 6.0 code and you want to change it to .NET, it is better to place it in a Visual Basic 6 project and then apply the upgrade wizard from within Visual Studio .NET

Hope this helps,
 
Upgrade wizard is never the best thing to use.

For writing to a file, look into the System.IO.StreamWriter class. Then use its WriteLine or Write methods to write to the file. Also, dont forget to use the Flush and Close method to make sure everything is written to the file.
 
Simple, VB6 to .NET wizard is not that good, I think a good start for you will be start reading about tha changes in Visual Basic (from 6 to .NET), also if you never used OOP will be a good time too to start reading about it.
If you know what you did in VB6 (the code you posted) after reading a few references on the .NET library youll be able to upgrade your code
 
Back
Top