Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 75351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:30:09+00:00 2026-05-10T20:30:09+00:00

So i’m not really sure why this is happening but I’m running through some

  • 0

So i’m not really sure why this is happening but I’m running through some DataRows where I have the control name, property, and value that I want to set. Everything works fine except when I set the TEXT property of a button. For some reason, the click event is called…

Here’s some of the code I’ve got:

string controlName, value, property; Control currentControl = null; System.Reflection.PropertyInfo propertyInfo = null;  // run through all rows in the table and set the property foreach (DataRow r in languageDataset.Tables[_parentForm.Name].Rows) {   controlName = r['ControlName'].ToString().ToUpper();   value = r['Value'].ToString();   property = r['Property'].ToString();    // check all controls on the form   foreach (Control c in formControls)   {     // only change it if its the right control     if (c.Name.ToUpper() == controlName)     {       propertyInfo = c.GetType().GetProperty(property);        if (propertyInfo != null)         propertyInfo.SetValue(c, value, null);  ******Calls Event Handler?!?!******       //        currentControl = c;       break;     }   } } 

So why in the world would it call the event handler when setting the value? Here’s what I’m setting it with that’s causing this:

<SnappletChangePassword>     <ControlName>buttonAcceptPassword</ControlName>   <Property>Text</Property>     <Value>Accept</Value> </SnappletChangePassword> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T20:30:10+00:00Added an answer on May 10, 2026 at 8:30 pm

    I can’t reproduce this with a simple short but complete program:

    using System; using System.Drawing; using System.Reflection; using System.Windows.Forms;  class Test {     static void Main()     {         Button goButton = new Button {              Text = 'Go!',             Location = new Point(5, 5)         };          Button targetButton = new Button {             Text = 'Target',             Location = new Point(5, 50)         };         goButton.Click += (sender, args) => SetProperty(targetButton, 'Text', 'Changed');         targetButton.Click += (sender, args) => MessageBox.Show('Target clicked!');          Form f = new Form { Width = 200, Height = 120,                 Controls = { goButton, targetButton }         };         Application.Run(f);     }      private static void SetProperty(object target, string propertyName, object value)     {         PropertyInfo property = target.GetType().GetProperty(propertyName);         property.SetValue(target, value, null);     } } 

    Can you come up with a similarly complete program which does demonstrate it?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.