Hii

csharp Malawi
  • 9 years ago

    I have problem with chekedlistbox, pls can anyone help me!!!!

    My prob is  when i click on my datagrid view, my checkedlistbox was checked, and when i click on another record in grid my checkedlistbox item was selected but previous selected item is still in checked state which i dont want to happen that. I dont know how to unselect that item in list box. I tried different sort of things, but no help.

    These are the things i tried but still am not able to solve

    checkedListBox1.SetItemCheckState(checkedListBox1.Items.IndexOf(dtTable.Rows[row_index][5]),CheckState.Unchecked);

    checkedListBox1.SetSelected(checkedListBox1.Items.IndexOf (dtTable.Rows [row_index][5]),false);

    checkedListBox1.SetItemChecked(checkedListBox1.Items.IndexOf(dtTable.Rows[row_index][5]),false);

    am not able to find where the prob is?? pls help me...

  • 9 years ago

    Are you saying that in your checkedlistbox you only ever want one item to be checked?

    ie say the checkedlistbox contained "apple", "banana", "orange", "grape" and the caption read: "choose your favourite fruit:" you'd then only want one item to be checked.

    ... as oppossed to "check all fruits that you like eating" - which would be a multi-select choice.

    Joe 

     

  • 9 years ago

    hi priya,

     i cant get what u r saying. can u please send me the screen shot of your datagrid...

    Florence

  • 9 years ago

    Yes, I want only 1 item to be checked in checkedlistbox and this checking has to be done when i click on a record in a Grid. Actually i have grid having 5 columns in it, my fifth columns goes to checkedlistbox, so whatever the vale present in grid in fifth column has to be checked in checkedlistbox. Like wise each record has some different value, every time when i click on grid the selection in the checkedlistbox als has to change. In opposite to this am not able to make the checkedlistbox show only 1 item at a time. It is showing multiple selection which i dont need at all. I hope u'll understand and try to explain me.

    Thanks in advance

  • 9 years ago

    priya

    u r having checkedlistbox or checkbox in the column??

    y u use checkedlistbox in a column?

    just send me a screen shot to my id florence.devasahayam@wipro.com

    Confused

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” - Brian Kernighan