Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem converting C# example into VB.NET equivalent
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Problem converting C# example into VB.NET equivalent
Miscellaneous
Thread ID:
01046878
Message ID:
01046878
Views:
65
Can anyone take a stab at turning this C# example into the VB.NET equivalent code. It's quite simple I'm sure. I just moved, can't find which box I put all of my reference books into and the Visual Studio help just isn't too helpful to me at this hour.
request.item = new Item[1];
Item item = new Item();
item.id = "0";
item.unitPrice = "29.95";
request.item[0] = item;
I thought the following would work just fine but I keep getting the error message: 'Object reference not set to an instance of an object' when the last line of the following code block executes. It's apparent I don't understand arrays in VB/C# very well.
Me.oItem = New Item
Me.oItem.id = CType(Session("liItemID"), String)
Me.oItem.unitPrice = CType(Session("liItemAmount"), Decimal)
Me.oItem.quantity = 1
'The code above works fine ... the error occurs when I try 
'the following.
Me.oRequest.item(0) = Me.oItem
Help please.

Thanks,

CTBlankenship
Next
Reply
Map
View

Click here to load this message in the networking platform