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

  • Thread starter Thread starter be.special
  • Start date Start date
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?
 
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
 
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
 
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
 
it should work only in .net 2003 and not in 2005, and in 2005 she sould
use the second reply
 
it should work only in .net 2003 and not in 2005, and in 2005 she sould
use the second reply

In my VB 2005 Express TypeOf works fine.

-Teemu
 

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

Back
Top