Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 28th, 2005, 09:20 PM
Authorized User
 
Join Date: Jan 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Controling a Form with Another in VB6

I am creating an ADO database with multiple forms to input the data. I am trying to pass a variable from Form 2 to Form 1 which I have done. But I would also like this to trigger a Private Sub on Form 1. How do I write this into code? Thanks for any help!

 
Old March 1st, 2005, 11:49 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I don't think you can, as you have written this.

But if you put a hidden control on frmOne, and changed the value of that control, perhaps you could use the OnChange of the control as the triggered event, and the control’s value as the frmOne local “variable.”
 
Old March 1st, 2005, 05:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can't you declare Public the sub in form1, something like

public sub PleaseCallMe()

so you can call it from form2: form1.PleaseCallMe

Another possibility is to add a public event in form2, and in form1 declare form2 withevents. Then in form2 just raise that event

Marco
 
Old March 3rd, 2005, 06:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Or you could do it if you changed the Public variable to a Public Property Let because then you could call the private sub from the Let sub.
 
Old March 3rd, 2005, 12:11 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Oooh! Good idea!
I totally forgot about the ability to add properties to forms.
I wish I had posted that!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Controling Cash Register With VBA Code wkalo Access ASP 5 July 22nd, 2008 07:07 PM
controling MDI menu from child dash dev C# 2005 1 January 26th, 2008 01:03 PM
controling loops pabo Access 8 April 13th, 2006 05:12 PM
Controling the Number of Records On A DataGrid Pag macupryk General .NET 1 October 7th, 2004 11:15 PM
Controling Window.Close( ) vijay_rb ASP.NET 1.0 and 1.1 Basics 7 September 29th, 2004 05:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.