473,513 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Q: forms

Hi

I have a form (form A) which displays another form (form B). Is there a way,
from formB to see events/variables in formA whilst formB is displayed?

Geoff
Nov 21 '05 #1
5 848
"Geoff Jones" <no********@email.com> schrieb:
I have a form (form A) which displays another form (form B). Is there a
way, from formB to see events/variables in formA whilst formB is
displayed?


Pass a reference pointing to form A to your instance of form B. You can do
this in a property or a method parameter, for example.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
Hi Herfried

Could you give me some example code to do so via a property?

Thanks in advance

Geoff

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
"Geoff Jones" <no********@email.com> schrieb:
I have a form (form A) which displays another form (form B). Is there a
way, from formB to see events/variables in formA whilst formB is
displayed?


Pass a reference pointing to form A to your instance of form B. You can
do this in a property or a method parameter, for example.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Inside FormB, alter the constructor to take a reference to FormA:

'*** FormB ***
Private _formA As FormA

Public Sub New(parentform As FormA)
_formA = parentform
End Sub
Then inside FormA when you show FormB you would call it like this (for
example from a button click):

Dim frmB As New FormB(Me)

Notice that Me refers to FormA and it is passed into FormB. From
inside form B you can use the private variable to access all the
properties/methods of FormA.

HTH

Chris

Nov 21 '05 #4
Just to add something to Chris's post, if you also want the events declare
the form with withevents
Private _formA As FormA 'no events Private withevents _formA as FormA 'withe events

Hth Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

"Chris Dunaway" <du******@gmail.com> schreef in bericht
news:11**********************@g43g2000cwa.googlegr oups.com... Inside FormB, alter the constructor to take a reference to FormA:

'*** FormB ***
Private _formA As FormA

Public Sub New(parentform As FormA)
_formA = parentform
End Sub
Then inside FormA when you show FormB you would call it like this (for
example from a button click):

Dim frmB As New FormB(Me)

Notice that Me refers to FormA and it is passed into FormB. From
inside form B you can use the private variable to access all the
properties/methods of FormA.

HTH

Chris

Nov 21 '05 #5
Many thanks Everybody

Geoff

"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:e$*************@TK2MSFTNGP15.phx.gbl...
Just to add something to Chris's post, if you also want the events declare
the form with withevents
Private _formA As FormA 'no events

Private withevents _formA as FormA 'withe events

Hth Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

"Chris Dunaway" <du******@gmail.com> schreef in bericht
news:11**********************@g43g2000cwa.googlegr oups.com...
Inside FormB, alter the constructor to take a reference to FormA:

'*** FormB ***
Private _formA As FormA

Public Sub New(parentform As FormA)
_formA = parentform
End Sub
Then inside FormA when you show FormB you would call it like this (for
example from a button click):

Dim frmB As New FormB(Me)

Notice that Me refers to FormA and it is passed into FormB. From
inside form B you can use the private variable to access all the
properties/methods of FormA.

HTH

Chris


Nov 21 '05 #6

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

Similar topics

3
2268
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of master form. Method 2 opens the form but when I right click on the Notify Icon I don't get the context menu that I should be seeing. I can interact with...
7
2454
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls each with a couple of controls in them I then rebuilt my project and my new panels and all controls they contained are gone... I've looked through...
13
5549
by: MD | last post by:
I have been converting a program from VB6 to VB.Net and enhancing it as well. All has been progressing OK although its been hard work. Now, all of a sudden, when I try to execute a ShowDialog() on one of my forms I get "An unhandled exception of type 'System.ExecutionEngineException' occurred in system.windows.forms.dll". I can't work out...
3
1628
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. This work fine for most cases, allowing the user to resize the form (and controls within the form. The forms them selves are create dynamically...
3
2357
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes get MyVarialble is not declared errors when the variable is quite clearly declared, when I change it to public and then back again to private the...
0
7270
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7178
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7565
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...
0
7543
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...
1
5103
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...
0
4759
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3255
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...
0
3242
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
817
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.