anusdesai
asked on
Structure in vb.net
Hi,
How do i convert this code from vb 6.0 to vb.net
Type AutoRunDetails
Name As String
doControls As Boolean
ReportTotal As Integer
ReportType(1 To 20) As String
ReportName(1 To 20) As String
End Type
Also how do add values in it
example vb 6.0
RunDetails(BatchNo).Report Type(RptCo unt) = "RI"
but if i do the same in vb.net
by:
Structure AutoRunDetails
Dim Name As String
Dim doControls As Boolean
Dim ReportTotal As Short
<VBFixedArray(20)> Dim ReportType() As String
<VBFixedArray(20)> Dim ReportName() As String
Public Sub Initialize()
ReDim ReportType(20)
ReDim ReportName(20)
End Sub
End Structure
code:
RunDetails(BatchNo).Report Type(RptCo unt) = "RI"
i get error object not set to reference
How do i convert this code from vb 6.0 to vb.net
Type AutoRunDetails
Name As String
doControls As Boolean
ReportTotal As Integer
ReportType(1 To 20) As String
ReportName(1 To 20) As String
End Type
Also how do add values in it
example vb 6.0
RunDetails(BatchNo).Report
but if i do the same in vb.net
by:
Structure AutoRunDetails
Dim Name As String
Dim doControls As Boolean
Dim ReportTotal As Short
<VBFixedArray(20)> Dim ReportType() As String
<VBFixedArray(20)> Dim ReportName() As String
Public Sub Initialize()
ReDim ReportType(20)
ReDim ReportName(20)
End Sub
End Structure
code:
RunDetails(BatchNo).Report
i get error object not set to reference
ASKER
Yes,i have done that
ReDim RunDetails(BatchTotal)
ReDim RunDetails(BatchTotal)
change
<VBFixedArray(20)> Dim ReportType() As String
<VBFixedArray(20)> Dim ReportName() As String
to
Dim ReportType(20) As String
Dim ReportName(20) As String
if you want two fixed arrays with 20 elements.
You cannot change instance data from within a method in a struct. You can only change static data.
If you want to do this sort of thing, why not just use a class and the constructor?
<VBFixedArray(20)> Dim ReportType() As String
<VBFixedArray(20)> Dim ReportName() As String
to
Dim ReportType(20) As String
Dim ReportName(20) As String
if you want two fixed arrays with 20 elements.
You cannot change instance data from within a method in a struct. You can only change static data.
If you want to do this sort of thing, why not just use a class and the constructor?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cheers mate
Dim RunDetails() As AutoRunDetails
ReDim RunDetails(20)
For example.