12 October 2011

Get Multiple value from CheckedListbox in C#



Get Multiple value from CheckedListbox in C#

For Example:
 private void LoadSectionDetails()
        {
            try
            {
                DataTable dt;
                dt = objSectionDetailsBR.DisplayAll();

                if (dt.Rows.Count > 0)
                {
                    chbLSection.DataSource = dt;
                    chbLSection.DisplayMember = "SectionName";
                    chbLSection.ValueMember = "SectionID";
                }
           
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }


//To get the value member and display member in Checkedlistbox in C#


 foreach (var item in chbLSection.CheckedItems)
            {
                var row = (item as DataRowView).Row;
                int id = row.Field("SectionID");
                string name = row.Field("SectionName");
              //  MessageBox.Show(id + ": " + name);
            }

No comments:

Post a Comment

Comments Welcome

Consistency level in Azure cosmos db

 Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...