M
Massimo
I have a Winforms applications, connected to a SQL Server 2000 database. The
main forms has a typed DataSet filled with the full content of a table from
the DB, and on the form there is a ListBox showing a single column of the
table (namely, a customer's name). There are also three buttons: "Add",
"Edit" and "Delete". The user can select a row from the list and click on
the "Delete" one, and the record is gone (this part is ok); or, he can
select a row and click on "Modify", or maybe simply click on "Add". In both
cases, a dialog form shows up, filled with the customer's data in the first
case, empty in the second one; the form has many TextFields bound to
specific columns of the DataSet, and when the user clicks on "Ok" the
database is updated with the modified row, or, if he clicks on "Cancel", any
change is rejected.
Can someone please point me in the right direction to implement this? I know
how to bound controls to specific columns of the DataSet, but how can I
match the current row with the one that was selected in the ListBox? Also,
how can I handle the case in which a new row needs to be created (but can
also be rejected)? I tried many approaches but none of them fully worked
(see previous threads in this same newsgroup), and the wizard included with
Visual Studio for creating data access forms creates code which is not
exactly (euphemism...) what I'm trying to achieve.
Thanks
Massimo
P.S.
Visual Studio 2003, .NET Framework 1.1.
main forms has a typed DataSet filled with the full content of a table from
the DB, and on the form there is a ListBox showing a single column of the
table (namely, a customer's name). There are also three buttons: "Add",
"Edit" and "Delete". The user can select a row from the list and click on
the "Delete" one, and the record is gone (this part is ok); or, he can
select a row and click on "Modify", or maybe simply click on "Add". In both
cases, a dialog form shows up, filled with the customer's data in the first
case, empty in the second one; the form has many TextFields bound to
specific columns of the DataSet, and when the user clicks on "Ok" the
database is updated with the modified row, or, if he clicks on "Cancel", any
change is rejected.
Can someone please point me in the right direction to implement this? I know
how to bound controls to specific columns of the DataSet, but how can I
match the current row with the one that was selected in the ListBox? Also,
how can I handle the case in which a new row needs to be created (but can
also be rejected)? I tried many approaches but none of them fully worked
(see previous threads in this same newsgroup), and the wizard included with
Visual Studio for creating data access forms creates code which is not
exactly (euphemism...) what I'm trying to achieve.
Thanks
Massimo
P.S.
Visual Studio 2003, .NET Framework 1.1.