473,588 Members | 2,471 Online
Bytes | Software Development & Data Engineering Community
+ 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 1128
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********@gma il.com> kirjoitti
viestissä:11*** *************** ****@u72g2000cw u.googlegroups. 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********@gma il.com> kirjoitti
viestissä:11*** *************** ****@i40g2000cw c.googlegroups. 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********@gma il.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/EnumerateContro ls.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
2879
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 updating if you hit the key (refresh) it inserts another record ... I have tried: 1. Clearing the vMemo field after the insert is done (vMemo = "") 2. Setting the value on the form for this field to "" Neither of these are working. It's not...
4
4420
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 End If If TypeOf c Is DropDownList Then CType(c, DropDownList).SelectedIndex = 0 End If Next
1
1027
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 pause for 5 seconds and then automatically second form should be display. i have tried timer control and timer property, but i can't do that.
1
1091
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 should also be shown on the second form when this is opened. The lables on the second form that need to be updated are on a tabcontol. I've tried gotfocus, activated, visiblechanged and god knows what else. The lables are changed only at the startup...
4
4450
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 page and takes data out of the field - the session variable is persisting. i tried the following, and it didn't work - I'm not sure where to go from here. Any advice would be appreciated. The string being passed is both the variable name and the...
1
2447
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 EXISTS(SELECT name FROM ..sysobjects WHERE name = N'#Temp' AND xtype='U') DROP TABLE #Temp Every once in a while, something will happen to cause a hiccup and the table doesn't clear. The result is no results, not an error message (reader fails). I added the...
1
1861
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. Please provide code. Thanx
0
1034
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 master-detail relationship record printing as this.. sorry i am not able to attach image
2
1254
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 has a very complex form and i notice that the first time that i use that form in the application the form opens fast, but after that it opens very slowly. I can only think that the problem has to do with cleaning the variables/objects. Does this...
0
8357
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6634
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5398
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3847
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2372
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1459
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1196
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.