hi everyone,
how to read my event click in my buttons inside my single groupbox? I want to count until 7 by using loop on how many times that buttons inside my goupbox has been clicked.
Loading
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.
VulpesPosted Sep 10, 2011, 11:56 AM
Black DiamondPosted Sep 10, 2011, 9:37 AM
Prabhu RajaPosted Sep 10, 2011, 8:09 AM
You want to increment Count for a Button inside of a GroupBox is Clicked not for a Button Outside of GroupBox .
I attached Source Code with this mail.Hope it will be useful for you.
-----------------------------------------------------------
If it helps you, then mark as "Correct Answer"
Satyapriya NayakPosted Sep 10, 2011, 4:34 AM
Try this
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int Clicks;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Clicks ++ ;
this.label1.Text = "Button has been clicked::: " + Clicks + (Clicks == 1 ? " time." : " times.");
if (Clicks == 7)
{
MessageBox.Show("Sorry you cannot click");
this.Close();
}
}
}
}
Thanks
If this post helps you mark it as answer