473,811 Members | 2,930 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3076
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***@discussi ons.microsoft.c omwrote in message news:74******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c omwrote in message news:74******** *************** ***********@mic rosoft.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<FormmyForm s 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***@discussi ons.microsoft.c omwrote in message news:78******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c omwrote in message news:74******** *************** ***********@mic rosoft.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<FormmyForm s 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*******@googl email.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*******@goog lemail.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<FormmyForm s 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*******@googl email.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
3224
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 with. Any and all help is appreciated. 1) On start of the app, he wants a circle to appear in the middle of the screen. 2) Clicking the circle allows the user to type 2-3 words in (on?) the
6
2706
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 http://www.lebans.com/DownloadFiles/A2kTooltip.zip So far the classes work perfectly, except that now I need to extend it to support other controls besides the ones given in the example form. I have gotten it to work with some controls, but not others. I...
1
4017
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 live databases on the network. Is there a way, via code, when I get back in-house from being on the road to click a button, and select the backends I want to link to? I would want to delete all the current links and link to the "live"
0
2190
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 PostMessage messages. My problem is that when I install the message handler the second time a "Fatal stack overflow error" occurs.
3
4268
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 of a subclassed DataGridTextBoxColum dos not seem like a practical way to do it. I have subclassed a DataGrid and overridden the OnPaint as such:
2
4851
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 unreliable. It will sometimes return incorrect results. I've got it isolated to the Form's Handle property. If nothing touches my form's Handle before the supplementary threads are fired off, then InvokeRequired has about a
6
2159
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 called when the form is loaded. this.Load += new System.EventHandler(this.dataBoundGridForm_Load); I mean if I compare form load with the C-tor I think that it's enough to put the code into the C-tor instead
2
4411
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 (before I incorporate them in another program). I just can’t seem to get a non-static call to work in my thread that has access to the Form1 variables and controls I need. I can call a non-static function using another class but then I can seem to get in...
1
3705
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 a form in MS Access, on that form, I have 2 buttons & a text box. One button is to select a mdb file, whom properties i want to display. Second button then stores that properties in a Excel file. when I open the file using first button, the path of...
0
10653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10395
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7674
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5564
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4352
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.