Hello
I have got about 14 textboxes which use similar routines, the routines read and write to the textboxes the same way, the only difference is these routines is the name of the textbox.
is it possible for me to create a generic routine which will manipulate the textboxes in the same way.
e.g i have 5 textboxes,
footext1, footext2, footext3, footext4 & footext5
now the routine is say
VB Code:
footext1_change() uppervalue = 100 lowervalue = footext2.text if ((footext1.text<uppervalue ) and (footext1.text>lowervalue)) then error_flag=true else footext1 = 30 error_flag = false end if end sub
and for text2 it is
VB Code:
footext2_change() uppervalue = 100 lowerrvalue = footext3.text if ((footext2.text<uppervalue ) and (footext2.text>lowervalue)) then error_flag=true else footext2 = 30 error_flag = false end if end sub
with 15 textboxes i would have to repeat the code 15 times
now if i had some sort of textbox i could have one routine and call it from every textboxes change method
something like
VB Code:
private function call_common_routine(uppervalue,lowervalue,currenttextbox) if ((currenttextbox<uppervalue) and (currenttextbox>lowervalue)) then error_flag=true else currenttextbox = 30 error_flag = false end if end function
footext2_change()
uppervalue = 100
lowerrvalue = footext3.text
currenttextbox = footext2.text
call_common_routine(uppervalue,lowervalue,currenttextbox)
end sub
[/Highlight]
is such a routine possible, passing textboxes, the way i do it it just copies the textbox contents to variable and passes it, i wanted to pass the current textbox "handle(?)" to the common routine.




Reply With Quote