Netnoobie
Well-known member
Hello, I have a snippet of sample code for adding a new row to a datagrid. But its in C# and I get a funny error when I tried to convert the code to VB. Here are the lines Im 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 Im 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 Im 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)Couldnt store <> in DailyID Column. Expected type is Int64.
So yeah, something is totally wrong, and its pointing me to the Add(rowValues) line.
Any help with sorting this out would be greatly appreciated. Thanks!
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 Im 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 Im 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)Couldnt store <> in DailyID Column. Expected type is Int64.
So yeah, something is totally wrong, and its pointing me to the Add(rowValues) line.
Any help with sorting this out would be greatly appreciated. Thanks!