473,383 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How to check if a control exists?

Hi:

Some of my controls (e.g. TextBox, DropDownList, ...) are created
programmingly, so I have to check if a certain control exists, like:

if the TextBox control exists, get it value.
else ......
How can I do this?

Thanks

Q.
Nov 18 '05 #1
2 17973
The FindControl method might work well for you.
For example:
If IsNothing(FindControl("TextBox1")) Then 'control doesn't exist

Here's more info:
http://msdn.microsoft.com/library/de...ntroltopic.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Quentin Huo" <q.***@manyworlds.com> wrote in message
news:eo**************@TK2MSFTNGP12.phx.gbl...
Hi:

Some of my controls (e.g. TextBox, DropDownList, ...) are created
programmingly, so I have to check if a certain control exists, like:

if the TextBox control exists, get it value.
else ......
How can I do this?

Thanks

Q.

Nov 18 '05 #2
On Fri, 28 May 2004 17:36:43 -0700, "Steve C. Orr [MVP, MCSD]"
<St***@Orr.net> wrote:
The FindControl method might work well for you.
For example:
If IsNothing(FindControl("TextBox1")) Then 'control doesn't exist

Here's more info:
http://msdn.microsoft.com/library/de...ntroltopic.asp

Of course if you are controlling whether the control exists or not,
then you should be able to decide if it is there, right? Not bashing
or anything, and I have been known to use this type of code, but you
should know if a control exists or not since you "programatically"
created it or set it to not display, eh?

Nov 18 '05 #3

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

Similar topics

4
by: MLH | last post by:
From FormA or from the immediate window, what can I run to determine if a specified control (say, "MyComboBox") exists on FormB (or ReportB)? We could narrow it down, specifying that FormB (or...
10
by: Raymond | last post by:
Hi All: To find a file exists using the file name, I have tow routings on UNIX system. 1. access(2) 2. lstat(2) This tow function also can do. When the return value is "-1" and errno is...
4
by: Hardik Shah | last post by:
Hi, I have created a form , and have a different controls on them. I want to check that control has particular property name or not. I wrote following code , tell me what I missing :- Dim...
1
by: James | last post by:
vb.net 2003 i wrote a windows service that does threading. My codes are a) the service thread will read a list of machine from a text file (machines.txt). b) it then logon using the below...
0
by: Herb | last post by:
is there a way in an SQL stored proc to determine if a temp table exists before selecting from it....I have a java app. that is calling a stored proc. i want to check if Java created the table before...
0
by: ovaisrkhan | last post by:
I want to implement spell check control which will check spelling mistakes in text item and provide suggested words in case of mistakes. I urgent need soluion for this. Thanks Sham
0
by: philip.poole | last post by:
Hi everyone, I am settings up some .NET controls on my website and want to create template controls to completely separate the business layer and the presentation layer. However I have...
3
by: Melbfella | last post by:
G'day All, I'm creating a classic ASP page that draws pieces dynamically. In some cases, I need to draw a <selecttag and populate it. I then want to hide this control immediately and pop it...
2
Manikgisl
by: Manikgisl | last post by:
HI. How to check File exists in Web Share C# try { WebRequest request = HttpWebRequest.Create("http://www.microsoft.com/NonExistantFile.aspx"); request.Method = "HEAD"; // Just get...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.