Hi ,
I'm need to get values for all the checked Items. regretfully, I'm getting
every time the value of the last cheked Item.
//Populate Data Into myClb
strQuery = "SELECT code,title FROM tbl1"
orclDa =
orclDa.Fill(orclDs, "tbl1");
myClb.DataSource = orclDs.Tables["tbl1"];
myClb.DisplayMember = "title";
myCld.ValueMember = "code";
myClb.SelectedIndex = -1;
// Start Checkingforeach (object itemChecked in clbMifalim.CheckedItems)
{
MessageBox.Show(" Value is:" + clbMifalim.SelectedValue.ToString() + ".");
}
Please Help
Regards Boaz.

Get Value From CheckedListBox
GoPrior
Now I get :
value is : "System.Data.DataRowView"
Thanks Anyway,
BOAZ.
dinks
I just ran into this issue and I just used the following to grab from the chec
foreach (DataRowView row in checkedlistbox.CheckedItems)
{
MessageBox.Show(row["<DisplayMember>"].ToString());
// Or use the index of your datatable your looking for.
MessageBox.Show(row[1].ToString());}
ThomasFreudenberg
foreach
(int i in myList.SelectedIndices){
DataRowView drv = (DataRowView)myList.ItemsmyStr = drv.Row[lstMifalim.ValueMember].ToString();
MessageBox.Show(myStr);}
Enjoy.
Kaliko
Tahnks anyway,
Boaz.
paulmig
hi Boaz, i tried with your code. but there is one small problem.
then i have 2 items selected in the checkedlistbox, the messagebox will keep showing the first selected item.
that means if i have 4 items in clb and 2 are selected, the msgbox will be showed twice.
SQL2005usr
Leonardo Carlos Prada
foreach (object itemChecked in clbMifalim.CheckedItems)
{
MessageBox.Show(" Value is:" + itemChecked.ToString() + ".");
}
Gazeth
foreach
(int i in myList.SelectedIndices){
DataRowView drv = (DataRowView)myList.ItemsmyStr = drv.Row[myList.ValueMember].ToString();
MessageBox.Show(myStr);}
Enjoy.
Aamir Iqbal
Change this Statement
MessageBox.Show(" Value is:" + clbMifalim.SelectedValue.ToString() + ".");
TO
MessageBox.Show(" Value is:" + itemChecked.ToString() + ".");
The reason Why it is showing the last item is that you are not using itemChecked object to get the value, instead you are using the Listbox itself..