How to Set Checkedbox on always by default for specific value in the Listbox in windows form
I have a listbox and bind it with the database by the following way
it may contains more than two values
Case 1:
Admission Fees
Others
Case 2:
Admission Fees
Tution Fees
Others
Now I want to set the Checked on always by default for "Others". I mean when I open this form then in the Form_Load event
the checkbox for the Others must b on always.
How to get the solution???
private void ShowFeesHeadSec()
{
con = new SqlDbConnect();
con.SqlQuery("select af.HeadID,HeadName,Amount from tblFeesAssign as af inner join tblAcademicYear as ay on af.YearID=ay.YearID inner join tblDefClass as dc on af.ClassID=dc.ClassID inner join tblDefSection as ds on af.SectionID= ds.SectionID inner join tblFeesHead as fh on af.HeadID=fh.HeadID where af.YearID=@YId and af.ClassID=@CId and af.SectionID=@SId order by FeeCatID desc;");
con.Cmd.Parameters.Add(new SqlParameter("@YId", this.cmbYear.SelectedValue.ToString()));
con.Cmd.Parameters.Add(new SqlParameter("@CId", this.cmbClass.SelectedValue.ToString()));
con.Cmd.Parameters.Add(new SqlParameter("@SId", this.cmbSection.SelectedValue.ToString()));
//con.Cmd.Parameters.Add(new SqlParameter("@Month", this.cmbMonth.SelectedValue.ToString()));
sTable = new DataTable();
paging.SelectCommand = con.Cmd;
paging.Fill(sTable);
chkHead.DataSource = sTable;
chkHead.DisplayMember = "HeadName";
chkHead.ValueMember = "HeadID";
}