Ive been working on a project which allows forms to edit information for a database. For one form I must have:
• An import button which should start an Open File dialog and using appropriate filtering allow the user to select the house details text file.
• A button which saves the record to the data source (database).
• A button which cancels the new record within the dataset.
• A close button to return to the main menu.
Ive made out the form as seen above. I really don't know how to save the record or cancel a new record. I think Ive got the import function working. Could anyone hear give me a hint towards what could be used to fix this?
The code im currently using is shown below:
private void Import_Load(object sender, EventArgs e)
// TODO: This line of code loads data into the 'estateAgentDataSet.house' table. You can move, or remove it, as needed.
I really don't know how to save the record or cancel a new record. I think Ive got the import function working. Could anyone hear give me a hint towards what could be used to fix this?
when you say save to a data source (database) do you mean an actual database or something like a text file that is acting as a database?
if you're talking about a text file you can use System.IO.Streamwriter to append text to an existing text file.
and what is the exact purpose of the cancel button? it looks to me like a button that would clear the text boxes when clicked on it, in that case you'd want call the method clear() on them either one by one or put them in a collection class like <list> and then loop through them
Specifically, use code tags around sections of code- it formats it so it's easy to read.
If you're working with a SQL Server backend, then I highly reccomend LINQ to SQL- there are a ton of tutorials on Google for the details. It's very easy to use- much easier than ADO.NET (in my opinion).