Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

you want to access things which are defined outside the sub ? (from inside the sub) ? if that is the case, yes there is a way to do it quite easily.

 

But case2: If you want to access the protected sub here is some info:

Edited by DR00ME

"Everything should be made as simple as possible, but not simpler."

"It's not that I'm so smart , it's just that I stay with problems longer ."

- Albert Einstein

Posted
you want to access things which are defined outside the sub ? (from inside the sub) ? if that is the case, yes there is a way to do it quite easily.

 

But case2: If you want to access the protected sub here is some info:

 

euhm and what is the easy way? i'm not quite following you sry.

and yes i want to acces thing from inside the sub.

here is the code i have problems with:

   server.vb:
   -----------
   Protected Overrides Sub OnStart(ByVal args() As String)
       MyServer.SetPort(sApache_server_port)
       MyServer.SetRunLevel(Threading.ThreadPriority.Normal
       MyServer._start()
   End Sub

MyServer and sApache_server_port are both definde in main.vb

but i can't acces them

Posted (edited)
euhm and what is the easy way? i'm not quite following you sry.

and yes i want to acces thing from inside the sub.

here is the code i have problems with:

   server.vb:
   -----------
   Protected Overrides Sub OnStart(ByVal args() As String)
       MyServer.SetPort(sApache_server_port)
       MyServer.SetRunLevel(Threading.ThreadPriority.Normal
       MyServer._start()
   End Sub

MyServer and sApache_server_port are both definde in main.vb

but i can't acces them

 

 

Maybe I bulls*** now but try it... lol

 

 

1. 'Put this in server.vb

Private main As New main(Me) 

 

 

2. 'Put this in main.vb

Private trick As server

Public Sub New(ByVal trk As server)
           trick = trk
End Sub

 

you have to do both operations in order to make it work....

 

 

3. you could also try putting 

Private trick as main

in your server.vb

and making MyServer and sApache_server_port   Public in main....

 

after doing phase 1. and 2.

 

you should be able to access the methods or whatever like this:

 

 

Protected Overrides Sub OnStart(ByVal args() As String)

main.MyServer.SetPort(main.sApache_server_port)

main.MyServer.SetRunLevel(Threading.ThreadPriority.Normal

main.MyServer._start()

End Sub

 

 

or option 3.

 

Protected Overrides Sub OnStart(ByVal args() As String)

trick.MyServer.SetPort(trick.sApache_server_port)

trick.MyServer.SetRunLevel(Threading.ThreadPriority.Normal

trick.MyServer._start()

End Sub

 

remember to make the things public you want to use.

 

or something like that... I might be totally wrong too... just play around and see what happens... :D

Edited by DR00ME

"Everything should be made as simple as possible, but not simpler."

"It's not that I'm so smart , it's just that I stay with problems longer ."

- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...