Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create new row in dataset and move to it
Message
De
28/01/2010 11:09:41
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01446330
Message ID:
01446339
Vues:
44
>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);
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform