Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create new row in dataset and move to it
Message
From
28/01/2010 11:09:41
 
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01446330
Message ID:
01446339
Views:
45
>Hi,
>
>I have a button on my form captioned "Add New". When user clicks on this button a new row should be added to the dataset and the controls (e.g. textboxes) of the form should show this new row.
>
>Here is what I did:
>
>
>btnAddNew_click()
>{
>            oMyDataSet.dtMyTable.Rows.Add();
>
>            bindingSource1.MoveLast();
> }
>
>
>The above seem to add a new row to the data set but the "pointer" not moving there.
>
>However, in my GoToLast button by calling:
>
>bindingSource1.MoveLast();
>
>the pointer does go to the last row.
>
>What am I missing?

You need to create a row to be added:
DataRow r = oMyDataSet.dtMyTable.NewRow()
 oMyDataSet.dtMyTable.Rows.Add(r);
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform