Computing.Net > Forums > Programming > VB6 Please HELP!!!

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

VB6 Please HELP!!!

Reply to Message Icon

Original Message
Name: DON
Date: August 28, 2002 at 11:22:16 Pacific
Subject: VB6 Please HELP!!!
Comment:

I'm a true novice please help me!!
I have a form that displays an ID number. I need a second form based on the same table, That uses the ID number from the first form as a link criteria to display information only on the subject that has that ID number. I know how to create the forms, I just need help on the linking technique. Thank you so much for any help.


Report Offensive Message For Removal


Response Number 1
Name: Joe
Date: August 28, 2002 at 11:31:44 Pacific
Reply: (edit)

depends what you put the id into. If it's a text box, write this code in form2

din id as string

id = form1.text1.text

now you can use the data


Report Offensive Follow Up For Removal

Response Number 2
Name: Shuvro
Date: August 28, 2002 at 17:50:01 Pacific
Reply: (edit)


before you do that, it is better to put a public before the dim statement, so that it may become available for all subsequent procedures and functions.


Report Offensive Follow Up For Removal

Response Number 3
Name: An uncertainty H
Date: August 29, 2002 at 02:01:04 Pacific
Reply: (edit)

I would say it is almost always better to not make variables public. Especially with a name as vague as "ID".

Tom


Report Offensive Follow Up For Removal

Response Number 4
Name: ashish
Date: August 29, 2002 at 04:32:19 Pacific
Reply: (edit)

Please try this solution... i think that this will surely work ....
u declare the Id not in the form but in one module and when ever you are scnning the id u can say Id.text=module.id ....now u can call this value anywhere in any where by saying module1.id .....inm the second form u can say that diaplay where id=module1.id...
in the general sections of module1 declare it as PUBLIC ID AS STRING...
bye thankyou


Report Offensive Follow Up For Removal

Response Number 5
Name: A Certain TH
Date: August 29, 2002 at 08:55:20 Pacific
Reply: (edit)

(If you have multiple modules / functions / subroutines / etc, then pass the data you need between them by either value or reference. This way you do not get confused when you build bigger projects with many variables. This way you can call functions from as many places as you like without worrying about whether you wanted a variable to stay constant. This way if someone else has to support your code, they will only have to look locally for variable names rather than hunting through pages of code. This way, you keep a much tighter reign on the variables you create. This way you have a clear picture of the scope of the variable you have created and so can understand its function much better. This way you can reuse variable names - such as "ID" - in as many functions as you like and since they only have local scope they will not be overwriting eachother. This way you will learn that the use of global variables, at a basic level of programming, is for short-cuts and quick fixes only: If you rely on them, they will soon get well out of hand.)

This is a message board for multiple opinion. Mine is: LEARN HOW TO PASS VARIABLES BETWEEN FUNCTIONS AND ROUTINES. Its really useful. Honestly. Promise.

But do whatever makes you happy. It really makes no difference to me.

Tom


Report Offensive Follow Up For Removal


Response Number 6
Name: BaBa
Date: August 31, 2002 at 14:13:20 Pacific
Reply: (edit)

Hi guys,

Don, put the id number in a public variable.
Declare the variable in a module as public, then use the if statement from form2 to get the information.
If Form1.textbox.text="12345" Then
Form2.textbox.text=whatever
Just to give you an idea.


Report Offensive Follow Up For Removal

Response Number 7
Name: BaBa
Date: August 31, 2002 at 14:14:49 Pacific
Reply: (edit)

Hi guys,

Don, put the id number in a public variable.
Declare the variable in a module as public, then use the if statement from form2 to get the information.
If Form1.textbox.text="12345" Then
Form2.textbox.text=whatever
Just to give you an idea.
remember 12345 is pulled from the public variable.


Report Offensive Follow Up For Removal






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software