Click here to Skip to main content
15,908,626 members
Home / Discussions / C#
   

C#

 
AnswerRe: cast string to control.Property Pin
Shakeel Iqbal7-Feb-10 20:40
Shakeel Iqbal7-Feb-10 20:40 
You can do like this


// find control
Control[] controls = this.Controls.Find("button1", true);

if (controls.Length > 0)
{

    Control control = controls[0];

    // get properties
    PropertyInfo[] properties = control.GetType().GetProperties();

    foreach (PropertyInfo controlProperty in properties)
    {

        // check property name
        if (controlProperty.Name == "Text")
        {
            // set value of control
            controlProperty.SetValue(control, "My new Value", null);
        }
     }

}
-----------------------------
Shakeel Iqbal
------------------------------
My New Article
Task Manager

QuestionRe: cast string to control.Property Pin
jojoba20107-Feb-10 20:51
jojoba20107-Feb-10 20:51 
AnswerRe: cast string to control.Property Pin
Dave Kreskowiak8-Feb-10 2:07
mveDave Kreskowiak8-Feb-10 2:07 
QuestionBackup & Restore Pin
Sivaooty7-Feb-10 19:51
Sivaooty7-Feb-10 19:51 
AnswerRe: Backup & Restore Pin
Eddy Vluggen7-Feb-10 20:53
professionalEddy Vluggen7-Feb-10 20:53 
QuestionHOOKING WINSOCK FUNCTIONS in C#? Pin
ritz12347-Feb-10 19:36
ritz12347-Feb-10 19:36 
Questionhow to set the connection time out for a tcp client Pin
prasadbuddhika7-Feb-10 19:01
prasadbuddhika7-Feb-10 19:01 
AnswerRe: how to set the connection time out for a tcp client Pin
Jimmanuel8-Feb-10 7:05
Jimmanuel8-Feb-10 7:05 
QuestionMessage Removed Pin
7-Feb-10 18:43
sima37-Feb-10 18:43 
Questionhow to close a tcp connection in c# Pin
prasadbuddhika7-Feb-10 18:39
prasadbuddhika7-Feb-10 18:39 
AnswerRe: how to close a tcp connection in c# Pin
Dave Kreskowiak8-Feb-10 2:05
mveDave Kreskowiak8-Feb-10 2:05 
Questionب Pin
sima37-Feb-10 18:23
sima37-Feb-10 18:23 
AnswerIgnore Pin
Not Active7-Feb-10 18:32
mentorNot Active7-Feb-10 18:32 
GeneralRe: Ignore Pin
sima37-Feb-10 18:42
sima37-Feb-10 18:42 
Questionit appears the tab control doesn't have a click event so how can i make one ? Pin
tonyonlinux7-Feb-10 18:14
tonyonlinux7-Feb-10 18:14 
AnswerRe: it appears the tab control doesn't have a click event so how can i make one ? Pin
Not Active7-Feb-10 18:18
mentorNot Active7-Feb-10 18:18 
QuestionByte Array to uint (Hex Decimal Value) Little help [I Solved It] Pin
xEvOx7-Feb-10 17:23
xEvOx7-Feb-10 17:23 
AnswerRe: Byte Array to uint (Hex Decimal Value) Little help Pin
xEvOx7-Feb-10 17:58
xEvOx7-Feb-10 17:58 
GeneralRe: Byte Array to uint (Hex Decimal Value) Little help Pin
Luc Pattyn8-Feb-10 1:20
sitebuilderLuc Pattyn8-Feb-10 1:20 
QuestionClearing out controls all at one time in winform [Solved] Pin
tonyonlinux7-Feb-10 17:04
tonyonlinux7-Feb-10 17:04 
AnswerRe: Clearing out controls all at one time in winform Pin
Luc Pattyn7-Feb-10 17:09
sitebuilderLuc Pattyn7-Feb-10 17:09 
AnswerRe: Clearing out controls all at one time in winform Pin
Not Active7-Feb-10 17:11
mentorNot Active7-Feb-10 17:11 
GeneralRe: Clearing out controls all at one time in winform Pin
tonyonlinux7-Feb-10 17:58
tonyonlinux7-Feb-10 17:58 
QuestionVB6 to c#. Pin
A.Machan Kachan7-Feb-10 15:29
A.Machan Kachan7-Feb-10 15:29 
AnswerRe: VB6 to c#. Pin
Not Active7-Feb-10 16:56
mentorNot Active7-Feb-10 16:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.