want to check whether a label is clicked or not in windows application.
hi,
want to check whether a label is clicked or not in windows application.how can we do it...help required...
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Oct 24, 2009, 10:26 AM
Then Here is Code For it
please check "Do you like this answer" if it helps you :)
int ClickCount = 0;
private void Form1_Load(object sender, EventArgs e)
{
foreach (Control c in tableLayoutPanel1.Controls)
{
if (c is Label)
{
((Label)c).Click +=new EventHandler(Label_Click);
}
}
}
public void Label_Click(Object Sender,EventArgs e)
{
ClickCount++;
lblClickCount.Text = ClickCount.ToString();
}
Kirtan PatelPosted Oct 24, 2009, 9:50 AM
Just Write Code Like Below to Check Weather It Clicked or Not
private void label1_Click(object sender, EventArgs e)
{
MessageBox.Show("Label Clicked !!");
}
please check "Do you like this answer" if my answer helps you :)
if still need assistance then let me know :)