|
-
Jul 16th, 2004, 11:31 AM
#1
Thread Starter
Member
Module/Class (maybe) help
hi, could someone please tell me the correct way of doing this...
As an example, I have a form with a few variables and a few buttons/labels etc on it. All i want to do is simple things such as on button click, change a variable value then update a label with the new value. Clearly this would be very easy to do by clicking on the button and adding the code directly to the click button event but several people will be working on different button click events so what I need to do is create additional vb files, then on the button click run the code within the additional file (but have the program treat the additional file as though the code was simply written in the button click event area so variables etc can still be accessed).
I'm sure this can be done but have no idea how (being new to this...).
I'm sorry if i have made little sence here, please let me know if you need further explanation. Many thanks to anyone who can help.
-
Jul 16th, 2004, 12:13 PM
#2
Member
'Here you go...
'1) Create a module called basMain and add it to your project.
'In there, do this.
Module basMain
Public Function Stupid(ByVal txt As String, ByVal label As Label)
label.Text = txt
End Function
End Module
'In the button click event on the form, you would do:
Stupid(TextBox1.Text, Label8)
-----------------------------------------------------
'TextBox1.Text is refering to a text box and label8 is referring to a lable. When you execute the command button, It takes the value in the text box and puts it into the label.
-
Jul 16th, 2004, 12:17 PM
#3
Member
Oh, and stupid does not refer to you... Just thought I would clarify that.
-
Jul 16th, 2004, 12:19 PM
#4
Frenzied Member
Come on, this is 2004. Encapsulate that sucker in a class.
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Jul 16th, 2004, 12:26 PM
#5
Member
Yes, he is correct. If you are new at this though, try to create your module and do a simple call. Once you have done that, move to a class. You may want to invest in a book called Visual Basic.Net step by step. Would help you tremendously.
Jim Webster - MCSD, MCSE
Last edited by jwebster03; Jul 16th, 2004 at 12:33 PM.
Jim Webster
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
|