We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Form Control Access

Thread ID:

Created:

Updated:

Platform:

Replies:

34547 Sep 12,2005 05:06 PM UTC Dec 19,2005 05:25 AM UTC Windows Forms 1
loading
Tags: FAQ
Greg Walsh
Asked On September 12, 2005 05:06 PM UTC

In reference to FAQ 2.32: "Windows Forms Controls/How can I add a control to a Window Form at runtime?" Once controls have been added, how do you reference events to them? The "click" and MouseUp" events I have manually keyed are being ignored.

Administrator [Syncfusion]
Replied On December 19, 2005 05:25 AM UTC

Hi To add a control to form at runtime first u need to create the control . then add to form.finally add eventhandlers to catch events.4 ex if u want to add a a button using c# Button b=new Button(); b.Text="hai"; b.Location=new Point(100,300); to add button to a form u need to use Controls.Add(b); to get events u should add a handler like this b.Click+=new EventHandler(b_Click); then define the eventhandler body private void b_Click(object obj,EventArgs e){ MessageBox.Show("Button clicked"); } u wil get a clearcut idea if u go thro the "Windows Form Designer generated code" region >In reference to FAQ 2.32: >"Windows Forms Controls/How can I add a control to a Window Form at runtime?" > >Once controls have been added, how do you reference events to them? The "click" and MouseUp" events I have manually keyed are being ignored.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;