Finding Calling Control

M

Materialised

Hi All,

I have a problem.

I have multiple text boxes on one form. When the user clicks in any of these
text boxes, another (search) form opens which queries a database and returns
the search results to the textbox.

Now as I said I have multiple shared textboxes on the first form. I need to
know a why I can pass to my search form which textbox in perticular called
the search window.

Does anyone know of a way to achieve this?

I am using VB.Net 2003.

Many Thanks
 
M

Materialised

Materialised said:
Hi All,

I have a problem.

I have multiple text boxes on one form. When the user clicks in any of
these text boxes, another (search) form opens which queries a database and
returns the search results to the textbox.

Now as I said I have multiple shared textboxes on the first form. I need
to know a why I can pass to my search form which textbox in perticular
called the search window.

Does anyone know of a way to achieve this?

I am using VB.Net 2003.

Many Thanks

Sorry I also did mean to mention I know I can do this using a public
variable. But I am looking for a better way.

Thanks
 
G

Guest

I assume you're launching the search form from one of the textbox events. If
that is the case, the event should have a "sender" parameter that could be
passed to the search form if you need the textbox in that form. You could
have a public property in the search form and a private variable that holds a
reference to your textbox.

If you're querying a database and returning the results to the textbox, you
probably don't even need to pass the textbox to the search form unless you
use the textbox for some other reason in the search form. All you should have
to do is show the search form using the ShowDialog method and then use the
results returned from your query after you return from showing the search
form. The search form would then need to have a public property to pass back
the query results.

Hope this helps.
 

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