Convert VB6 module to VB.NET

I almost finished converting the module from VB6 to VB.NET, but I am having problems with the following two quotes, and I am wondering if there is a way to do this:

Structure AUDINPUTARRAY
    bytes(5000) As Byte
End Structure

I am trying to change this byte string to: Dim bytes (5000) as Byte but this does not allow me to determine the size in the structure.


Here's the second one:

Private i As Integer, j As Integer, msg As String * 200, hWaveIn As integer

I have no clue on how to convert: msg As String * 200

+5
source share
3 answers

you cannot declare the initial size in VB.Net, you can set its size later using the Redim operator in the constructor or anywhere

Structure AUDINPUTARRAY
    Public bytes() As Byte
    Public Sub New(ByVal size As Integer)
        ReDim bytes(size) ' set size=5000

    End Sub


End Structure

Visual Basic.NET , VBFixedStringAttribute Class . .

. , . http://msdn.microsoft.com/en-us/library/f47b0zy4%28v=vs.71%29.aspx ,

    Private i As Integer, j As Integer, hWaveIn As Integer
    <VBFixedString(200)> Private msg As String
+4

Public Structure <StructLayout(LayoutKind.Sequential)> AUDINPUTARRAY
   Public <MarshalAs(UnmanagedType.ByValArray, SizeConst := 5000)> 
     Bytes() As Byte
End Structure
+1

, , VB6 .net, , msg As String * 200. , 200- , , .

VB6 ( ), , 200- . , :

String msg = String(' ', 200)

( VB.net, #).

0
source

All Articles