clearing all the lables on a form in vb.net 2005

B

be.special

hi!
i have the following code:

for each control ni controls
dim tb as lable
if typeof ctl is lable then
tb = ctype(ctl,Lable)
tb.text = string.empty
end if
next

but in .net 2005, i can't write typeof . is there another syntax for it?
 
B

be.special

instead of
<if typeof ctl is lable then>
use:
dim tb as lable = TryCast(ctl, lable)
and ask:
If tb IsNot Nothing Then
tb.text = string.empty
 
T

Teemu

hi!
i have the following code:

for each control ni controls
dim tb as lable
if typeof ctl is lable then
tb = ctype(ctl,Lable)
tb.text = string.empty
end if
next

but in .net 2005, i can't write typeof . is there another syntax for it?

Hello!

It should work. Try this:

If TypeOf (Ctl) is Label Then
...
End If

-Teemu
 
T

Teemu

for each control ni controls
Hello!

It should work. Try this:

If TypeOf (Ctl) is Label Then
...
End If

And naturally it has to be "If TypeOf (Control) is Label" in your case.

-Teemu
 
B

be.special

it should work only in .net 2003 and not in 2005, and in 2005 she sould
use the second reply
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top