jorge Posted March 12, 2004 Posted March 12, 2004 hey, is there a way to use varibale and classes defined outside it to work inside a Protected sub? doesn't seem to work. Quote Jorge - http://www.blackdot.be/?page=apache.htm
DR00ME Posted March 12, 2004 Posted March 12, 2004 (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 March 12, 2004 by DR00ME Quote "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
jorge Posted March 12, 2004 Author Posted March 12, 2004 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 Quote Jorge - http://www.blackdot.be/?page=apache.htm
DR00ME Posted March 12, 2004 Posted March 12, 2004 (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 March 12, 2004 by DR00ME Quote "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
jorge Posted March 13, 2004 Author Posted March 13, 2004 Thnx i'll play with it a bit Quote Jorge - http://www.blackdot.be/?page=apache.htm
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.