Netnoobie Posted February 10, 2003 Posted February 10, 2003 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! Quote
Leaders quwiltw Posted February 10, 2003 Leaders Posted February 10, 2003 You're adding an array of strings but it appears that the DailyID column of the dataset is set to be an integer. Have you checked that out? Quote --tim
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.