.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Group Box

Posted By: Chandranshu Awasthi     Posted Date: May 13, 2011    Points:5   Category :C#
i hv dynamically created a group box and each hv 10 buttons in it which are also dynamically created.
my problem is that i want to know that the user has clicked the button belongs to which group box............


can anyone pls help me

Responses
Author: Dhiraj Ranka          Accepted Answer   
Posted Date: May 15, 2011     Points: 40   

Hi,

You can check for clicked button's .Parent property. It should give you the GroupBox.

Hope this helps

Hope this helps.

Thanks & Regards,
Dhiraj Ranka
http://www.twitter.com/dhirajranka | http://www.dhirajranka.com
Author: Chandranshu Awasthi             
Posted Date: May 16, 2011     Points: 20   

thanks Dhiraj

Author: Narayanan             
Posted Date: July 12, 2011     Points: 20   

Hi,
In Declaration Side
private System.Windows.Forms.GroupBox GB;
String str;
Form Loading
GB = new GroupBox();
GB.Name = "GroupName1";
GB.Height = 1000;
GB.Width = 1000;
GB.Left = 10;
GB.Top = 10;
this.Controls.Add(GB);

Button Btn = new Button();
Btn.Name = "Button1";
Btn.Text = "Test";
Btn.Height = 20;
Btn.Width = 45;
Btn.Left = 45;
Btn.Top = 150;
Btn.Click += new System.EventHandler(this.clickEvent);
GB.Controls.Add(Btn);

private void clickEvent(object sender, EventArgs e)
{
str = GB.Name;
MessageBox.Show("Group Name" + " " + str);


}
Regards,
Lakshmi Narayanan.S

Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend