Stupid(?) newbie question

  • Thread starter Thread starter Michael Lebang
  • Start date Start date
M

Michael Lebang

Hi there,

I'm just starting to work with C# and the ADO.NET.

As a test project i've choosen a simple Customer-Management Application.

So here's my problem:

In my main form I have a DataGrid that should display all my Customers.
I've used a DataSet with NO Database Connection, just codes it manually
and using XML-Files for storing data.

I have a MainMenu and there I select "Add new Customer", wich opens a
form to enter the Data and saves it in a DataSet (and in an XML-File).

How do I update the DataGrid in the Main Window, when a Customers has
been enterd in my "frmAddCustomer" form?

I now create the Dataset for storing the Customer-Data in the
btnSave_Click Method. Do I have to use the DataSet from the
MainWindow...and if so HOW? :o)

Please help a newbie. :o)

Thanks in advance!

Kind regards,
Michael
 
DataSetName.WriteXML("Path:\FileName.xml")

As long as the DataSet is scoped at the module level, you can see it from
anywhere, you'll be fine.
 
Hi William,

writing the XML-File works fine for me...the question is WHERE do I have
to setup my DataSet to hold the customer information?

I now create it in my "Add Customer Form" and therefore I dont see it in
my MainForm...

Maybe I have a totally wrong approach to handle this kind of situation??

Kind regards,
Michael
 
Declare it at the module level, ie up top in the code right under Public
Class ...
'Put it here
End Class
 
From what I gather, you are populating a datagrid using a dataset on the
main form. You are also giving an option to the user to click on Add New
Customer which opens another form. Here, the user can add another customer.
Now, you want the datagrid on the main form to show the updated customer
list.. I hope I am correct in this.

To do this, you can declare an event in the add new customer form and raise
that event after a new customer has been added. Also, add a handler to this
event in the main form. In this event handler, you can recreate the dataset
and bind the grid to this dataset. This will update the datagrid as soon as
a new customer has been added.

Let me know if this is not clear or if you need some sample code..


Hi there,

I'm just starting to work with C# and the ADO.NET.

As a test project i've choosen a simple Customer-Management Application.

So here's my problem:

In my main form I have a DataGrid that should display all my Customers.
I've used a DataSet with NO Database Connection, just codes it manually
and using XML-Files for storing data.

I have a MainMenu and there I select "Add new Customer", wich opens a
form to enter the Data and saves it in a DataSet (and in an XML-File).

How do I update the DataGrid in the Main Window, when a Customers has
been enterd in my "frmAddCustomer" form?

I now create the Dataset for storing the Customer-Data in the
btnSave_Click Method. Do I have to use the DataSet from the
MainWindow...and if so HOW? :o)

Please help a newbie. :o)

Thanks in advance!

Kind regards,
Michael
 
Back
Top