CheckBoxes allow the user to make multiple selections from a number of options. CheckBox to give the user an option, such as true/false or yes/no. You can click a check box to select it and click it again to deselect it.
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string msg = "";
if (checkBox1.Checked == true)
{
msg = "net-informations.com";
}
if (checkBox2.Checked == true)
{
msg = msg + " vb.net-informations.com";
}
if (checkBox3.Checked == true)
{
msg = msg + " csharp.net-informations.com";
}
if (msg.Length > 0)
{
MessageBox.Show (msg + " selected ");
}
else
{
MessageBox.Show ("No checkbox selected");
}
checkBox1.ThreeState = true;
}
}
}
No comments:
Post a Comment