Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 14th, 2003, 11:27 AM
Registered User
 
Join Date: Oct 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Convert "String" type to "Control" type ?


Hi,

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.

Cheers,
Kishore


 
Old November 21st, 2005, 12:28 AM
Registered User
 
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

thanks
Deepak


 
Old November 21st, 2005, 04:22 AM
Friend of Wrox
 
Join Date: Jun 2003
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
Default

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.

Regards
Ankur Verma
 
Old January 9th, 2006, 10:37 PM
Authorized User
 
Join Date: Jan 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


regards
rahul pokharna
 
Old January 11th, 2006, 01:21 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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")

-Peter





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





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