|
-
Jul 2nd, 2002, 11:38 AM
#1
Thread Starter
yay gay
How do i use "public" variables..?
i am using sockets and then with button1 i connect to another app...but then i need another button to close the connection...then i would need to make that the variable that points to the connection would be public so i can use it with the other button..how do i do that?
-
Jul 3rd, 2002, 06:46 AM
#2
Thread Starter
yay gay
-
Jul 3rd, 2002, 08:26 AM
#3
Public variable As Whatever
-
Jul 3rd, 2002, 04:38 PM
#4
Thread Starter
yay gay
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Public Listener As New TcpListener(21)
Listener.Start()
End Sub
it said:
C:\Documents and Settings\JBRANCO\My Documents\Visual Studio Projects\WindowsApplication3\Form1.vb(51): 'Public' is not valid on a local variable declaration.
-
Jul 3rd, 2002, 04:52 PM
#5
Frenzied Member
Dimensioning a public variable has to be done at module level. Like right underneath the line that sets the class name.
-
Jul 14th, 2002, 04:21 AM
#6
Fanatic Member
public variables
Put your declaration of your public variable above your sub/function. Not in Your sub/function. This should work. You do not need another module or class module to declare a public variable.
try omthing like this:
Public Listener As New TcpListener(21)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Listener.Start()
End Sub
hope it helps
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
|