473,320 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Using the form handle

I'm looking for a way to bring an open form to the top. I know that is I
open a form directly with form1.show() and then later, while the form is open
I do another form1.show(), that I will get original form to pop to the top.
But because I want to have multiple instances of form1 open, I open it with

dim frm as new form1
frm.show()

What I need to do now is reference the opened form from another window and
even pop it to the top if I want to. I've seen that I can capture
frm.Handle. If frm.Handle is 1234;

1) Can I
frm.handle(1234).show()
or
2) Can I
frm.handle(1234).textbox1.text = "Hello"

Thanks

Aug 14 '06 #1
5 3054
Hi Rich,

No, you can't.

Instead of storing the handle why not store a reference to the instance of the Form1 class that you need to show? Then you can just
call frm.Show(), as you mentioned.

You can search for a particular control by index or name as long as you have a reference to the Form.

--
Dave Sexton

"RichG" <Ri***@discussions.microsoft.comwrote in message news:74**********************************@microsof t.com...
I'm looking for a way to bring an open form to the top. I know that is I
open a form directly with form1.show() and then later, while the form is open
I do another form1.show(), that I will get original form to pop to the top.
But because I want to have multiple instances of form1 open, I open it with

dim frm as new form1
frm.show()

What I need to do now is reference the opened form from another window and
even pop it to the top if I want to. I've seen that I can capture
frm.Handle. If frm.Handle is 1234;

1) Can I
frm.handle(1234).show()
or
2) Can I
frm.handle(1234).textbox1.text = "Hello"

Thanks

Aug 14 '06 #2
Dave
Thanks for the reponse.
I guess a reference is what I thought I could get with the handle. How
would I obtain a reference that I could later address?
Thanks

"Dave Sexton" wrote:
Hi Rich,

No, you can't.

Instead of storing the handle why not store a reference to the instance of the Form1 class that you need to show? Then you can just
call frm.Show(), as you mentioned.

You can search for a particular control by index or name as long as you have a reference to the Form.

--
Dave Sexton

"RichG" <Ri***@discussions.microsoft.comwrote in message news:74**********************************@microsof t.com...
I'm looking for a way to bring an open form to the top. I know that is I
open a form directly with form1.show() and then later, while the form is open
I do another form1.show(), that I will get original form to pop to the top.
But because I want to have multiple instances of form1 open, I open it with

dim frm as new form1
frm.show()

What I need to do now is reference the opened form from another window and
even pop it to the top if I want to. I've seen that I can capture
frm.Handle. If frm.Handle is 1234;

1) Can I
frm.handle(1234).show()
or
2) Can I
frm.handle(1234).textbox1.text = "Hello"

Thanks


Aug 15 '06 #3
Hi RichG,

You wrote in your last post, "I've seen that I can capture frm.Handle".

Wherever in code you were going to assign a global variable to frm.Handle, simply store frm instead. Since you need to store
multiple references, you'll have to store a collection of forms.

If your using the 2.0 framework, you can use the following, for example:

Private List<FormmyForms As New List<Form>() 'how do you code generics in VB?

Private Function CreateForm() As Form
Dim frm As New Form1();
myForms.Add(frm)
Return frm
End Function

If you are using an earlier version of the framework just replace the generic list with an ArrayList, for example.

HTH (please forgive me for my lousy VB)

--
Dave Sexton

"RichG" <Ri***@discussions.microsoft.comwrote in message news:78**********************************@microsof t.com...
Dave
Thanks for the reponse.
I guess a reference is what I thought I could get with the handle. How
would I obtain a reference that I could later address?
Thanks

"Dave Sexton" wrote:
>Hi Rich,

No, you can't.

Instead of storing the handle why not store a reference to the instance of the Form1 class that you need to show? Then you can
just
call frm.Show(), as you mentioned.

You can search for a particular control by index or name as long as you have a reference to the Form.

--
Dave Sexton

"RichG" <Ri***@discussions.microsoft.comwrote in message news:74**********************************@microsof t.com...
I'm looking for a way to bring an open form to the top. I know that is I
open a form directly with form1.show() and then later, while the form is open
I do another form1.show(), that I will get original form to pop to the top.
But because I want to have multiple instances of form1 open, I open it with

dim frm as new form1
frm.show()

What I need to do now is reference the opened form from another window and
even pop it to the top if I want to. I've seen that I can capture
frm.Handle. If frm.Handle is 1234;

1) Can I
frm.handle(1234).show()
or
2) Can I
frm.handle(1234).textbox1.text = "Hello"

Thanks



Aug 15 '06 #4
Dave Sexton wrote:
Hi RichG,

You wrote in your last post, "I've seen that I can capture frm.Handle".

Wherever in code you were going to assign a global variable to frm.Handle, simply store frm instead. Since you need to store
multiple references, you'll have to store a collection of forms.

If your using the 2.0 framework, you can use the following, for example:

Private List<FormmyForms As New List<Form>() 'how do you code generics in VB?
Private myForms As New List(Of Form)

Think in English... code in English :)

--
Larry Lard
la*******@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Aug 16 '06 #5
Hi Larry,

Thanks for the answer. Very close to proper English, however, I never would have guessed that the use of an 'Of' operator is
required ;)

--
Dave Sexton

"Larry Lard" <la*******@googlemail.comwrote in message news:4k************@individual.net...
Dave Sexton wrote:
>Hi RichG,

You wrote in your last post, "I've seen that I can capture frm.Handle".

Wherever in code you were going to assign a global variable to frm.Handle, simply store frm instead. Since you need to store
multiple references, you'll have to store a collection of forms.

If your using the 2.0 framework, you can use the following, for example:

Private List<FormmyForms As New List<Form>() 'how do you code generics in VB?

Private myForms As New List(Of Form)

Think in English... code in English :)

--
Larry Lard
la*******@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version

Aug 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: ComputerSmith | last post by:
Hi all. I have programmed VB6 apps before, ones that use dropdown listboxes, text boxes, etc... normal stuff. I was asked by a friend to write a "simple" app that I am unsure how to proceed...
6
by: Robert | last post by:
Hello. I have been trying out the Lebans ToolTip Classes at http://www.lebans.com/tooltip.htm, to display "balloon" style help tips in a form. The classes I am using are located at...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
0
by: Marco Segurini | last post by:
Hi, I am trying to dynamically install/deinstall a message handler to a System.Windows.Forms.Form using NativeWindow. I do not use IMessageFilter derived class because it intercept only the...
3
by: Richard | last post by:
I have a requirement to put a GDI style circle or rectangle border around the selected row of a datagrid/ It will overlap into the row above and below the selected row. Doing this in a the OnPaint...
2
by: Sgt. Sausage | last post by:
Problem. Work-around. No issues, just looking to see if I'm the only one that's seen this. I just lost 3 hours (shoulda found it sooner) to the InvokeRequired on a form being somewhat...
6
by: tony | last post by:
Hello! When exactly is it important or advisable to use this form load event handler compare to using the C-tor. For example here I create an event handler called dataBoundGridForm that is...
2
by: lewisms | last post by:
Hello all, I am quite new to c++/. Net so please don't shoot me down for being a newbie. Any way I am trying to make a simple multithreading program that is just to learn the ideas behind it...
1
by: sunnyluthra1 | last post by:
Hi Everyone, I am working on a piece of code, that displays the properties(Name, Datatype, size & Description) of the table in the database. Now I want to further Enhance the code. I Have created...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.