i'm stuck on this since a few days
i need the translation from VB6 to VB.NET
i tried with the IO class and FileOpen but, never worked!Code:Open FileName For Binary As #1
Get #1, CurrentPOS, strData
Close #1
thanks
Printable View
i'm stuck on this since a few days
i need the translation from VB6 to VB.NET
i tried with the IO class and FileOpen but, never worked!Code:Open FileName For Binary As #1
Get #1, CurrentPOS, strData
Close #1
thanks
Try something like this:
VB Code:
Dim fs As IO.FileStream = New IO.FileStream(filename, IO.FileMode.Open)'open file Dim br As New IO.BinaryReader(fs)'read as binary Dim b() As Byte = br.ReadBytes(fs.Length)'now the contents are in a byte array Dim str As String = System.Text.Encoding.ASCII.GetString(b)'convert byte array to string br.Close()'close file fs.Close()
or to go the old way in .net it is
VB Code:
Dim intFile as integer = FreeFile FileOpen(intFile, "C:\bob.txt", OpenMode.Binary, OpenAccess.Read) FileClose(intFile)
Quote:
Originally posted by rudvs2
or to go the old way in .net it is
VB Code:
Dim intFile as integer = FreeFile FileOpen(intFile, "C:\bob.txt", OpenMode.Binary, OpenAccess.Read) FileClose(intFile)
Rudvs2 > yea i tried that but, how can i use the "GET #1, FilePosition, strData". I didnt figure it out...
Edneeis > Thanks, i'll try to work it out tonite.
thanks alot guys. ;p
The get statement has changed to fileget
FileOpen(1, "C:\TESTFILE.txt", OpenMode.Binary)
FileGet(FileNumber, Data,RecordNumber)
Jeremy
ataboy Jeremy...
thanks alot