hi
i want to exit sub / function outside the own method like this
public sub method1()
'the procedure code
call method2(1)
'the remind procedure code
end sub
public sub method2(number as integer)
if number=1
'exit method1()
end if
end sub
Loading
amin choroomiPosted Sep 7, 2005, 7:31 AM
let me explain my project
i have already 100 or more functions like method1()
also i have already a public property called MyPro1
in the Set(value as object) .... End Set
part of this property i have written mycode like method 2
i change MyPro1 in all of 100 functions
then i want to exit each one of methods that changed the property in special condition.
if u dont got it tell me to send the real class as a eMail to you.
thanx more for attention.
Andrew WoosterPosted Sep 6, 2005, 10:01 AM
Well, unless you are using threading you will not be in Method1 and Method2 at the same time.
I guess I don't really understand your question. Either Method1 is running or Method2 is running. If Method1 did not call Method2 then you can't "exit" Method1 from Method2.
Now, if you want to limit the excution of Method1 based on something in Method2 you could do something like this:
Private RunMethod1 as boolean = true
Private Sub Method1()
If Not RunMethod1 Then Exit Sub
'do stuff
end sub
Private Sub Method2()
'if you don't want to run method1
RunMethod1 = false
End Sub
amin choroomiPosted Sep 3, 2005, 3:57 PM
but i dont wanna do that because ican not
i actualy dont call method2()
but i only used an example to tell what i mean;
could you help me exiting method1() @ method2() ?
Andrew WoosterPosted Sep 2, 2005, 2:20 PM
'the procedure code
if method2(numberToPassIn) then exit sub
'the remind procedure code
end sub
public function method2(number as integer) as boolean
return number = 1
end function
This code assumes that you are doing nothing else in method2 other than checking if the number passed in is equal to 1.