Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27265

VS 2010 Raising Events between 2 forms

$
0
0
Hi,

I have a question about raising events between 2 forms to call a control on the other form.

Let's consider this scenario:

The OrderListForm contains a datagridview with some Orders as records. When double-clicking a row, the DetailOrderForm opens. This form contains a 'previous' and 'next' button, which allows the user to effectively browse through the Order list of the dgv in OrderListForm. I want the current selected row of the dgv to change whenever the user browses through the list using the navigation buttons.

I would normally have called the dgv control directly but, aside from the fact that is not the preferred way (which I've learned from jmcilhinney and I always try to follow his advice), it is cumbersome to hardcode each form because the DetailOrderForm can be called from other forms as well.

So my questions are:

1) Can you give me a code example on how to raise an event from one form so that a control on another form can be manipulated?

2) How can I make this as dynamically as possible, i.e. it will work from any form that has the control I want to manipulate. That form is always the owner of the DetailOrderForm.


As always, your input is very much appreciated.

Viewing all articles
Browse latest Browse all 27265

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>