|
-
Jun 24th, 2000, 12:37 PM
#1
Thread Starter
New Member
Can anyone please help!
I am making a program with mutiple forms in which all have similar procedures eg play stop whatever.
I have also created a class module in which I have detailed the code for these events, but when I call this code in the specific for it doesn't work because in the code the objects such as lblsong, lblartist, although common throughout the forms will not work. Also variables I have made in the module when I call in the particular form do not work.
What do I have to do to make the variables and objects work in all forms when they have the same names.
The subs are all public subs too
Thanks
-
Jun 24th, 2000, 12:42 PM
#2
Hyperactive Member
Hm... dunno really what your problem is...
but it seems your not creating a new object so use an ordinary module and Public the variables in the Declaration of that module too.
Signed, Rodik ([email protected])
Programmer,usesVB6ED
===========================
Copyright©RodikCo,2002.
Dont mind this signature ;] Its old
-
Jun 24th, 2000, 09:17 PM
#3
Fanatic Member
Hmmm... He's right, you should probably use a module instead of the class. But if I'm understanding you correctly you are having trouble retrieving values from form controls in the module. Here is a quick example of using forms and modules.
Form1 (Add a textbox and 2 buttons)
Form1:
Code:
Private Sub Command1_Click()
ShowMeTheMoney(text1.text)
End Sub
Private Sub Command2_Click()
WhatIsYourFavoriteColor
End Sub
Module1:
Code:
Function ShowMeTheMoney(txt As String) As String
ShowMeTheMoney = FormatCurrency(txt, 2, vbFalse, vbFalse, vbFalse)
End Function
Public Sub WhatIsYourFavoriteColor()
MsgBox Form1.Text1.Text
End Sub
Try it out, study it, pull what you need.
www.RealisticGraphics.net
Running VS.Net Enterprise & VB 6
Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML
MSN Messenger: kmsheff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|