"Jeff Williams" <je*******************@hardsoft.com.auwrote in message
news:13*************@corp.supernews.com...
>I have an application using dial monitors which is used in an aution room.
The auctioneer has a form showing details of the current lot number. As
he changes to the next lot number I need to send a message to a form on
the other monitor to change to picture to this new lot.
Shat is the best way to have a form send a message to another form.
ie Monitor one is showing lot 10 details and the monitor two is showing
the picture of lot 10. The auction moves to the next lot on his screen
(lot 11) and the form on the second monitor now updates with the details
of lot 11.
Are the monitors attached to the same computer? With a single .NET
application showing one .NET form on each monitor?
If so, then the answer is as simple as referencing one form from the other.
For example:
class Form1
{
private Form2 _form2;
public Form1()
{
_form2 = new Form2();
_form2.Show();
}
private void _UpdateText(string strNewText)
{
labelDetails.Text = strNewText;
_form2.labelDetails.Text = strNewText;
}
}
Unless you've done something whacky, both forms should be owned by the same
thread. But if not, you will have to use Invoke() or BeginInvoke() in the
_UpdateText() method shown above. Still, not very hard.
The controls on the form are likely going to be "private" by default. So
you'll need to change the access in the property browser to maket them
public so that the first form can access them. Alternatively, provide a
public method on the second form's class that the first form can call, which
then accesses the private control.
For images, just change the example as necessary to set whatever data you
want on whatever property of the form you want. The primary form could just
figure out what image the slave form needs to show, and set it explicitly,
or the slave form could maintain it's own list of images with the primary
form just calling a method on the slave form that takes some kind of index
as a parameter. The specifics don't matter much; the important thing to
understand is that you can maintain a reference in the primary form to the
slave form and do whatever it is you need to do like that.
If the two monitors are on two different computers, and/or the display for
each monitor is handled by two different processes, then it gets more
complicated. You'll need to use some sort of inter-process communications,
such as remoting or sockets to pass the updates from the primary display to
the slave display.
Pete