shortcircuit
New member
- Joined
- Dec 20, 2004
- Messages
- 3
- Programming Experience
- 10+
Hi all,
i'm stuck with a class problem, i want to create a class that, say for example gets the system time, and can be displayed in label or textbox but can be accessed many times....
ok i'll start with a pseudo example.
VB.NET
pseudo code....
public function test(variable)
do something....anything
eg get system date,time or anything
'**********************
label1.text=result 'This works here, but not in a class?
'**********************
end function
private sub form load
timer1.interval=500
timer1.enabled=true
end sub
private sub timer1_tick()
dim x as integer
test(x)
end sub
'This works fine but i want to put this in class so, it can be accessed many times.
class myclass
'maybe withevents of inherits timer1, not sure
public function test(variable)
do something....anything
'****problem here******
label1.text=result 'this will not work but to put in its place?
'*******************
end function
private sub timer1_tick()
dim x as integer
test(x)
end sub
end class
i cant figure out how to bring the data out of the class, for example if the data in displayed in a label, and use it to have say tens or thousands of labels that display this data, how do i extract it from the class.
thanx Andy
i'm stuck with a class problem, i want to create a class that, say for example gets the system time, and can be displayed in label or textbox but can be accessed many times....
ok i'll start with a pseudo example.
VB.NET
pseudo code....
public function test(variable)
do something....anything
eg get system date,time or anything
'**********************
label1.text=result 'This works here, but not in a class?
'**********************
end function
private sub form load
timer1.interval=500
timer1.enabled=true
end sub
private sub timer1_tick()
dim x as integer
test(x)
end sub
'This works fine but i want to put this in class so, it can be accessed many times.
class myclass
'maybe withevents of inherits timer1, not sure
public function test(variable)
do something....anything
'****problem here******
label1.text=result 'this will not work but to put in its place?
'*******************
end function
private sub timer1_tick()
dim x as integer
test(x)
end sub
end class
i cant figure out how to bring the data out of the class, for example if the data in displayed in a label, and use it to have say tens or thousands of labels that display this data, how do i extract it from the class.
thanx Andy