event handler

G

Greg Chu

Hi, all,

I have form which displays a data set and also a timer to read data every
one minute from a xml source and refresh the form.

The user click on a button on the form and bring up another form also
displays the same data set.

How do I send an event to tell the 2nd form that it also need refresh when
the first form runs the refresh routine?

My thinking is it should use "raise" event to tell the 2nd form that it is
time to refresh to screen.

Any one has done this before? Please help!

Thanks!

Greg
 
D

Doug Bell

Hi Greg,
I am doing something similar.
The way I approached it was to create a Data Access Layer.
When the application is opened, it retrieves data from a Database (DB2) into
a DataSet and then saves it into an XML file. If the Database is unavailable
it retrieves the data from the saved XML file into the DataSet.

The main form references the Data Access Class and uses the DataSet. The
timer on the main form tests the currency ( an hour in my case) of the data
and will call the Data Access Class to update the data.

The main form (Purchase Orders) allows the User to call up the Purchase
Order Details form which uses a different DataTable in the DataSet. Whenever
this form is opened its data is current as the main form has called the Data
Access Class to update all data. Both forms use Data Grids bound to
DataViews based on the Data Tables in the DataSet.

Doug
 
G

Greg Chu

You are saying "load" will refresh the data.
I am asking after "load" the form, I need to get notice from the mainform
that I need to get the dataset again since it has been changed.
 
D

Doug Bell

Greg, I think I see what you have.

You said that the second form was opened from the first form. I assumed
modally, but are you saying that the first form can be editited while the
second is open, causing the problem of unsynchronised data?
 
C

Cor Ligthert

Greg,

It goes exactly as you tell, therefore you have to create a public event in
form 2
raise that events in form 2 when happens what you tell
declare your form2 Friend withevents in form1
create your form2 using the declaration
and than catch that event the same as with a textbox or whatever.

Simple I thought?

Cor
 

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