Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Methods in a WinForm
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00724429
Message ID:
00724586
Views:
24
This message has been marked as the solution to the initial question of the thread.
You need to call the Add method of your Rows collection to actually add the DataRow to your DataTable. Here is some sample code:
Dim dr As DataRow
Dim fi As FileInfo
Dim dir As New DirectoryInfo("C:\")
Dim dt As New DataTable()

dt.Columns.Add("FileName", GetType(System.String))
dt.Columns.Add("Size", GetType(System.Int32))

For Each fi In dir.GetFiles()
  dr = dt.NewRow()
  dr(0) = fi.Name
  dr(1) = fi.Length
  dt.Rows.Add(dr)
Next
>Update, I created a empty dataset modifying the sql statement to return an empty table perform the Addnew() command work fine. Try to assign the new value for the column and receive the error there no row 0, Excecute the count comand and return 1 so what is wrong?
>
>the line used was
>'xtext any text box in the form that i dont remember the name now.
>objsocio_economica.table("socio_Economica).row(0)("num_control") = xtext.tostring()
>also I try to replace the 0 with 1 and get the same result. The dataset is bound to a grid and the grid is showing the new row when I execute the addnew() command.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform