Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 14th, 2003, 11:27 AM
Registered User
Join Date: Oct 2003
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Convert "String" type to "Control" type ?


I have a string "Panel". Now i want to convert this string "Panel" to the control type "Panel"( What we have already control). Please let me know how it is possible in C#.

Advance ThanX for your time & patience.


Reply With Quote
  #2 (permalink)  
Old November 21st, 2005, 12:28 AM
Registered User
Join Date: Nov 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

hi all,
   i want answe for the same question plz let me answer soon


Reply With Quote
  #3 (permalink)  
Old November 21st, 2005, 04:22 AM
Friend of Wrox
Join Date: Jun 2003
Location: , , .
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma

What is it that you are trying to ask? Do you mean that you want to CREATE a control of the type name stored in one of your string variables. Like if you have the value of your string varibale as "Panel" you want to create a panel type control (please varify if this IS what you are trying to do).
For doing such a thing there must be some way through reflection. Explore that. But simpler way would be to
write a logic (something like a switch case ...) which checks the string variable's value and creates a control of the relevent type.

Ankur Verma
Reply With Quote
  #4 (permalink)  
Old January 9th, 2006, 10:37 PM
Authorized User
Join Date: Jan 2006
Location: bangalore, karnataka, India.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts

hi all,
even i wanted to ask the same question. the problem is there is already a control named panel1.. now there is a string literal which contains "panel1". Now i wanted to convert this string into that control.
Please reply

rahul pokharna
Reply With Quote
  #5 (permalink)  
Old January 11th, 2006, 01:21 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

You can look in the controls collection of the page (or any class derived from "Control") and find a control by name:

myPanel = (Panel)Page.FindControl("panel1")

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
code of convert xml data type in string by C# prafullaborade XML 2 May 24th, 2008 07:49 AM
cannot implecitly convert type bool to string vaidyapragati General .NET 1 May 4th, 2007 09:10 PM
Conversion from type 'DBNull' to type 'String' is GailCG ASP.NET 2.0 Basics 5 February 22nd, 2007 03:12 PM
String Type Statement to convert field CORiverRat Access 5 December 15th, 2005 02:13 AM

All times are GMT -4. The time now is 10:59 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.