indexing problem when adding row

G

Guest

VS2003 C#
Hi,


I have a form with all txtboxes databound. A list box shows a list of names
which can be used to pick a record (using the find method to return the index
of the row. This index is then used to set the binding context position)

my problem is that when I add a row & accept changes to the table, the list
box (or more likely, the binding context object) seems to have its index
moved one up, so that picking a name now returns the *next* record. This
persists until the application is closed then started again.

Why is this happening? Am I missing out something? Here is how I save the
row...

newRow.contactMobile = frm.Mobile;
newRow.email = frm.Email;


// Add row to table
dsMain.contact.Rows.Add(newRow);

// persist data
daContact.Update(dsMain.contact);

// Accept changes made to the table
dsMain.contact.AcceptChanges();

Thanks greatly for any ideas

Ant
 
G

Guest

Additionally,

for each concurrent row added, the indexing gets offset by one. Three
inserts & the finding row 1 returns row 3.

I've noticed that when the row is added, it is displayed in the listbox at
the bottom of the list, even though it should be sorted in ascending order
alpabetically. This again persists until the app. is restarted st ehich point
it works fine.

Hope this helps

Ant
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top