Question Structure have warning after converting into VB.Net

alternator

New member
Joined
Feb 19, 2010
Messages
3
Programming Experience
3-5
Hello,

I try to code some function that use a structure. After converting from VB6 to VB.Net, it shows a warning. Did any body have any idea how to solve this warning. Here it is the error:

err2w.png


Here it is a sample test code:

VB.NET:
Option Strict Off
Option Explicit On
Module Module1
	
	Public Structure COOK
		Dim chicken As String
		Dim ham As Short
	End Structure
	
	Public Function testing(ByRef tools() As COOK) As Short
		Dim Count As Short
        Dim egg As COOK
		Count = 2
		ReDim Preserve tools(Count)
		'UPGRADE_WARNING: Couldn't resolve default property of object tools(Count). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		tools(Count) = egg
	End Function
	
	'UPGRADE_WARNING: Application will terminate when Sub Main() finishes. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E08DDC71-66BA-424F-A612-80AF11498FF8"'
	Public Sub main()
		Dim jjj() As COOK
		MsgBox(testing(jjj))
	End Sub
End Module

Thanks in advanced.
 
Not that big of a deal. vb6 used to auto initialize all variables where now you must explicitily do it.

Old
Dim strMsg As String

New
Dim strMsg As String = ""

I dont know what egg/cook is but most likely us simply want to set it to nothing

01) Dim egg As Cook = Nothing
02) Dim egg As New Cook
 
Back
Top