How can I get control's Name in form
Posted: Thu Aug 19, 2010 1:57 am
this is my button click event
-----------------------------------------
foreach (RadioButton obj in PanelControl2.Control.Controls)
{
MessageBox.Show(obj.Name); <----------------i got value: ""
MessageBox.Show(CustomerID.Name);<------i got value:CustomerID
if(obj.Checked)
{
var = obj.Name;
break;
}
}
---------------------------------------
CustomerID is a Radio Button
How can i got name when i use foreach?
and
If I dont want the form1.show how to do can let buttonOk click event in form1.load?
-----------------------------------------
foreach (RadioButton obj in PanelControl2.Control.Controls)
{
MessageBox.Show(obj.Name); <----------------i got value: ""
MessageBox.Show(CustomerID.Name);<------i got value:CustomerID
if(obj.Checked)
{
var = obj.Name;
break;
}
}
---------------------------------------
CustomerID is a Radio Button
How can i got name when i use foreach?
and
If I dont want the form1.show how to do can let buttonOk click event in form1.load?