不再支持错误 BC30829 'Get' 语句 - 从 vb6 转换为 vb.net
Error BC30829 'Get' statements are no longer supported - Converting from vb6 to vb.net
我正在将项目从 vb6 转换为 vb.net。
我转换了大部分但卡在了一条线上。
VB6 代码:
Do While Not EOF(FileO)
Get #FileO, , ByteBuffer
If Loc(FileO) < LOF(FileO) Then
ByteCounter = ByteCounter + 64
End If
Loop
VB.NET 代码:
Do While Not EOF(FileO)
Get(#FileO, , ByteBuffer) '----------> PROBLEM HERE
If Loc(FileO) < LOF(FileO) Then
ByteCounter = ByteCounter + 64
End If
Loop
我在 get 语句上遇到问题。
Get(#FileO, , ByteBuffer)
我面临的错误是:
Error BC30829 'Get' statements are no longer supported. File I/O functionality is available in the 'Microsoft.VisualBasic' namespace.
GET 语句的替代品是什么??如何申请?
谢谢 :)
作为快速入门 - 您应该使用 ide 和对象浏览器来查看您可以从中获得什么:
// make sure the read buffer is big enough
string testReadData = "".PadRight(128);
int filenumber = VB6FileSystem.FreeFile();
VB6FileSystem.FileOpen(filenumber, @"c:\temp\test.dat", VB.OpenMode.Random, RecordLength: 128);
// Write some test data ....
VB6FileSystem.FilePut(filenumber, "Testdaten 1", 1, true);
VB6FileSystem.FilePut(filenumber, "Testdaten 4", 4, true);
VB6FileSystem.FilePut(filenumber, "Testdaten 14", 14, true);
// Read some data ...
VB6FileSystem.FileGet(filenumber, ref testReadData, 14, true);
VB6FileSystem.FileClose(filenumber);
我觉得,你能掌握
Option Explicit On
Imports System
Imports System.IO
Module Module1
Sub Main()
Dim ByteBuffer As Byte()
Using myFile As BinaryReader = New BinaryReader(File.Open("TESTFILE.BIN", FileMode.OpenOrCreate))
While myFile.BaseStream.Position < myFile.BaseStream.Length
ByteBuffer = myFile.ReadBytes(64)
End While
myFile.Close()
End Using
End Sub
End Module
我正在将项目从 vb6 转换为 vb.net。
我转换了大部分但卡在了一条线上。
VB6 代码:
Do While Not EOF(FileO)
Get #FileO, , ByteBuffer
If Loc(FileO) < LOF(FileO) Then
ByteCounter = ByteCounter + 64
End If
Loop
VB.NET 代码:
Do While Not EOF(FileO)
Get(#FileO, , ByteBuffer) '----------> PROBLEM HERE
If Loc(FileO) < LOF(FileO) Then
ByteCounter = ByteCounter + 64
End If
Loop
我在 get 语句上遇到问题。
Get(#FileO, , ByteBuffer)
我面临的错误是:
Error BC30829 'Get' statements are no longer supported. File I/O functionality is available in the 'Microsoft.VisualBasic' namespace.
GET 语句的替代品是什么??如何申请?
谢谢 :)
作为快速入门 - 您应该使用 ide 和对象浏览器来查看您可以从中获得什么:
// make sure the read buffer is big enough
string testReadData = "".PadRight(128);
int filenumber = VB6FileSystem.FreeFile();
VB6FileSystem.FileOpen(filenumber, @"c:\temp\test.dat", VB.OpenMode.Random, RecordLength: 128);
// Write some test data ....
VB6FileSystem.FilePut(filenumber, "Testdaten 1", 1, true);
VB6FileSystem.FilePut(filenumber, "Testdaten 4", 4, true);
VB6FileSystem.FilePut(filenumber, "Testdaten 14", 14, true);
// Read some data ...
VB6FileSystem.FileGet(filenumber, ref testReadData, 14, true);
VB6FileSystem.FileClose(filenumber);
我觉得,你能掌握
Option Explicit On
Imports System
Imports System.IO
Module Module1
Sub Main()
Dim ByteBuffer As Byte()
Using myFile As BinaryReader = New BinaryReader(File.Open("TESTFILE.BIN", FileMode.OpenOrCreate))
While myFile.BaseStream.Position < myFile.BaseStream.Length
ByteBuffer = myFile.ReadBytes(64)
End While
myFile.Close()
End Using
End Sub
End Module