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 September 2nd, 2003, 07:27 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing Values from a Form to another

Help!!!!!!!!!!!

I have two forms, I am passing a value from an on click sub procedure that creates and shows a form to the form that is called but I am unsuccessful.

Do I have to create the form in the on click procedure using the new form and pass it to a procedure within that new form or can I pass it another way?

(Using VB6)

Thanks in advance

Louisa

 
Old September 2nd, 2003, 07:56 AM
Authorized User
 
Join Date: Jun 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You question is a bit vague but I believe your problem could be solved with the use of a global variable. The way I do this is to create a seperate module for my globals and assign their values when I need them .. like this.

----------------------------------------------------------------
basGlobals

Public gmyGlobal as DataType (whatever it needs to be string, integer, ect)
----------------------------------------------------------------

Private Sub Command1_Click()

   gmyGlobal = Value
   Form2.show

End Sub
----------------------------------------------------------

If you do it this way the value will be retained even if you unload the initial form. You do have to keep in mind that the global variable will hold the value you assign it until you either reassign it or end the program. My point there is you always need to be aware of it's value when using it in multiple places throughout your application or you may get some unexpected results.

Hope this helps.



Kenny Alligood





Similar Threads
Thread Thread Starter Forum Replies Last Post
passing Multidimensional Array Values back to form stitch Classic ASP Databases 2 June 21st, 2013 01:59 PM
Passing Form Values in ASP.Net sankar General .NET 10 September 21st, 2006 11:13 AM
Passing form values from 1 frame to another. edkeyte Javascript How-To 4 February 2nd, 2004 12:33 PM
Passing values to a form mschenk Access VBA 4 November 30th, 2003 11:39 PM





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