473,414 Members | 1,618 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,414 software developers and data experts.

How to access method in open form from another form.

Hi,

I am trying to execute a control method on an open form (not with focus)
from a modal dialog box. I want to increment the node selected from the
dialog when a certain key is pressed.

Any help appreciated.

Robert T
Nov 20 '05 #1
5 2441
* "twick10" <tw*****@hotmail.com> scripsit:
I am trying to execute a control method on an open form (not with focus)
from a modal dialog box. I want to increment the node selected from the
dialog when a certain key is pressed.


You will have to make a reference to the other form available to your
form. This can be done by setting a property to the other form when
instantiating the dialog from within the main form.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
I'm not sure I follow the recommendation. Can anybody clarify. Perhaps
with some sample code?

Robert

"twick10" <tw*****@hotmail.com> wrote in message
news:ee**************@TK2MSFTNGP12.phx.gbl...
Hi,

I am trying to execute a control method on an open form (not with focus)
from a modal dialog box. I want to increment the node selected from the
dialog when a certain key is pressed.

Any help appreciated.

Robert T

Nov 20 '05 #3
This is how I like to do it:

' In a module:
Friend FormMain As frmNAME ' The name of the main form

' Main Form Load:
FormMain = Me

' Inside the open dialog, you can access your main form using
FormMain.

--
Jay Feldman
Ja********@NOSPAMmonmouth.com
"twick10" wrote:
I'm not sure I follow the recommendation. Can anybody clarify. Perhaps
with some sample code?

Robert

"twick10" <tw*****@hotmail.com> wrote in message
news:ee**************@TK2MSFTNGP12.phx.gbl...
Hi,

I am trying to execute a control method on an open form (not with focus)
from a modal dialog box. I want to increment the node selected from the
dialog when a certain key is pressed.

Any help appreciated.

Robert T


Nov 20 '05 #4
Add another constructor to the dialog form that accepts the main form as a
parameter:
Private _frmCalling As Form1
Public Sub New(ByVal frmCalling As Form1)

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

_frmCalling = frmCalling

End Sub

You can then use the reference to the main form to access controls on that
form from the dialog

For example, in the click event of a button on the dialog, you could do the
following
_frmCalling.TextBox1.Text = "Set from form2"

which would change the text property of the textbox on the main form.

I'm not exactly sure what you are trying to change on the main form but this
should give you an idea of what to do.

-Mike
"twick10" <tw*****@hotmail.com> wrote in message
news:OW**************@TK2MSFTNGP09.phx.gbl...
I'm not sure I follow the recommendation. Can anybody clarify. Perhaps
with some sample code?

Robert

"twick10" <tw*****@hotmail.com> wrote in message
news:ee**************@TK2MSFTNGP12.phx.gbl...
Hi,

I am trying to execute a control method on an open form (not with focus)
from a modal dialog box. I want to increment the node selected from the
dialog when a certain key is pressed.

Any help appreciated.

Robert T


Nov 20 '05 #5
Thanks, Jay

Works like a charm

Bob
"Jay Feldman" <Ja********@NOSPAMmonmouth.com> wrote in message
news:B5**********************************@microsof t.com...
This is how I like to do it:

' In a module:
Friend FormMain As frmNAME ' The name of the main form

' Main Form Load:
FormMain = Me

' Inside the open dialog, you can access your main form using
FormMain.

--
Jay Feldman
Ja********@NOSPAMmonmouth.com
"twick10" wrote:
I'm not sure I follow the recommendation. Can anybody clarify. Perhaps
with some sample code?

Robert

"twick10" <tw*****@hotmail.com> wrote in message
news:ee**************@TK2MSFTNGP12.phx.gbl...
Hi,

I am trying to execute a control method on an open form (not with focus) from a modal dialog box. I want to increment the node selected from the dialog when a certain key is pressed.

Any help appreciated.

Robert T


Nov 20 '05 #6

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

Similar topics

4
by: Sami | last post by:
I hope someone will tell me how to do this without having to do any VB as I know nothing in that area. I am a rank beginner in using Access. I have created a database consisting of student...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
1
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
5
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all...
0
by: microb0x | last post by:
Is there any difference in the way an Access .mdb file is launched from directly double-clicking the file through windows explorer versus using code within another Access file to launch the...
3
by: rizwanrazzaq | last post by:
Hi friends here is my coding.. but i m facing one problem .. i used both mathod SQL mathod and open Record Set. but in both i m getting error massage can anyone help me out regarding thi. Please...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...
0
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...
0
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...

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.