473,473 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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?

May 3 '06 #1
6 1120
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

May 3 '06 #2

<be********@gmail.com> kirjoitti
viestissä:11**********************@u72g2000cwu.goo glegroups.com...
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

May 3 '06 #3
>> 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


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

-Teemu
May 3 '06 #4
it should work only in .net 2003 and not in 2005, and in 2005 she sould
use the second reply

May 3 '06 #5

<be********@gmail.com> kirjoitti
viestissä:11**********************@i40g2000cwc.goo glegroups.com...
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

May 3 '06 #6
<be********@gmail.com> schrieb:
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?


You surely still can write 'TypeOf...Is'.

<URL:http://dotnet.mvps.org/dotnet/samples/controls/EnumerateControls.zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
May 3 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Robin | last post by:
Ok, I have a form that on clicking of the Update button first updates the specific record in the db, then Inserts if the vMemo field is not empty. The problem that I'm having is that After...
4
by: Ali | last post by:
I used to clear my page's control in Visual Studio 2003 using code like this: Dim c As Control For Each c In Page.Controls(1).Controls If TypeOf c Is TextBox Then CType(c, TextBox).Text = Nothing...
1
by: nehal | last post by:
Sir, i want in my application, a form should display lables according to the data in the database means no. of lables are not decided. how can i do this ? i also want my first form should...
1
by: Jerry | last post by:
Hi again, I have two forms as controls. Both are on a main form and with a treeview I switch back and forth between the two. On the first form is a calculation. The result of this calculation...
4
by: Amy | last post by:
I'm having a problem with clearing my session variables. I'm using session variables to pass data from a web form to a pdf generator. The problem comes in when a user goes back to the original...
1
by: Esteban404 | last post by:
//using C# 2005, MS SQL 2000(prod) and SQL Express 2005 (dev) My sprocs all have a clearing mechanism at the end like this for each temporary table I use: --drop temporary tables IF...
1
by: namartajhamb | last post by:
I have one Confirm Message Box using Confirm() javascript function which display two buttons Ok and Cancel. I want to Change these buttons lables into YES/NO. how can i change lables of buttons....
0
by: Shalini Bhalla | last post by:
i want to generate lables on which records are coming from diff tables , in form of master -- detail relation ship , can you suggest me a good lable printing software which can help me in this...
2
by: =?Utf-8?B?UmljYXJkbyBGdXJ0YWRv?= | last post by:
for years, in every form i create in VB .Net 2005, in the FormClosing event i insert the following code: GC.Collect() GC.WaitForPendingFinalizers() but now i'm creating an application that...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.