I am building a simple app in c# using Visual C# 2010 Express. I have created a data entry form which captures some data.
I'd like to use that same form for when a user wants to edit some data. How would I go about writing the code to tell the form that it's in edit mode, so load recordID=4431. If it's not in edit more, then just blank and add a new record when save is pressed.
Any thoughts?! Cheers, Matt.
There a few ways of doing this. The simplest would be adding a hidden field to your form that would contain the ID of the object in edition, or null if it's a new submission.
Regards
Well,
I have done this before. What I did was create a function that retrieves the data for specified record. This function will then just populate the fields in the form.
To tell the form it's in edit mode I just use a boolean to specify this. It is also necessary to store the record being edited so you can update it after.
Is this what your looking for or do you want code samples?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With