Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello, I have a snippet of sample code for adding a new row to a datagrid. But it's in C# and I get a funny error when I tried to convert the code to VB. Here are the lines I'm having trouble with right now:

 

object[] rowValues = { "", "", "" };

ds.Tables[0].Rows.Add(rowValues);

 

in VB I have it being:

Dim rowValues As Object() = {"", "", "", "", "", "", "", "", "", ""}

ds.Tables(0).Rows.Add(rowValues)

 

The sample I'm woking with has a DG with three columns, and mine has approx 10. I see that I can assign the amount from three to 10 no big deal. But I'm getting this error:

 

System.FormatException: Input string was not in a correct format. at System.Number.ParseInt64(String s, NumberStyles style, NumberFormatInfo info) at System.String.System.IConvertible.ToInt64(IFormatProvider provider) at System.Convert.ToInt64(Object value) at System.Data.Common.Int64Storage.Set(Int32 record, Object value) at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't store <> in DailyID Column. Expected type is Int64.

 

So yeah, something is totally wrong, and it's pointing me to the Add(rowValues) line.

 

Any help with sorting this out would be greatly appreciated. Thanks!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...