By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 795 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

disabling checkbox in checkedlistbox

P: n/a
Hi Guys,

I have a checked list box on my form.. the purpose of this checkbox is
to indicate that the option is enabled or disabled.. I just want to ask
if there is a way to disable these check boxes from being checked or
unchecked.. i want them to always show their default value which i have
fetched from a xml file.. and also i dont want the checked list box to
be disabled, as i want the user to select any item but not change the
checked state.

Thanks in advance guys..

Jul 19 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Are you familiar with Infragistics controls or do you use them?

If so, this is how I would do it:

I would use thier Ultra DataGrid and add 2 columns to it. One is the
description column and the other is the boolean column. Then load your
data and disable editing and set the CellClickActions property of the
grid to RowSelect.

This way they can view and select but not edit.

If you use Microsoft's grid, you can try this method but no guarantees.

am************@gmail.com wrote:
Hi Guys,

I have a checked list box on my form.. the purpose of this checkbox is
to indicate that the option is enabled or disabled.. I just want to ask
if there is a way to disable these check boxes from being checked or
unchecked.. i want them to always show their default value which i have
fetched from a xml file.. and also i dont want the checked list box to
be disabled, as i want the user to select any item but not change the
checked state.

Thanks in advance guys..
Jul 19 '06 #2

P: n/a
I m using microsoft's checkedlistbox control.. i has builtin checkbox
with every item and i jus wan to disable that checkbox..

cant use datagrids.. ill have to change the control over more then 10
places :(

Izzy wrote:
Are you familiar with Infragistics controls or do you use them?

If so, this is how I would do it:

I would use thier Ultra DataGrid and add 2 columns to it. One is the
description column and the other is the boolean column. Then load your
data and disable editing and set the CellClickActions property of the
grid to RowSelect.

This way they can view and select but not edit.

If you use Microsoft's grid, you can try this method but no guarantees.

am************@gmail.com wrote:
Hi Guys,

I have a checked list box on my form.. the purpose of this checkbox is
to indicate that the option is enabled or disabled.. I just want to ask
if there is a way to disable these check boxes from being checked or
unchecked.. i want them to always show their default value which i have
fetched from a xml file.. and also i dont want the checked list box to
be disabled, as i want the user to select any item but not change the
checked state.

Thanks in advance guys..
Jul 19 '06 #3

P: n/a
I m using microsoft's checkedlistbox control.. it has builtin checkbox
with every item and i jus wan to disable that checkbox..

cant use datagrids.. ill have to change the control over more then 10
places :(

Izzy wrote:
Are you familiar with Infragistics controls or do you use them?

If so, this is how I would do it:

I would use thier Ultra DataGrid and add 2 columns to it. One is the
description column and the other is the boolean column. Then load your
data and disable editing and set the CellClickActions property of the
grid to RowSelect.

This way they can view and select but not edit.

If you use Microsoft's grid, you can try this method but no guarantees.

am************@gmail.com wrote:
Hi Guys,

I have a checked list box on my form.. the purpose of this checkbox is
to indicate that the option is enabled or disabled.. I just want to ask
if there is a way to disable these check boxes from being checked or
unchecked.. i want them to always show their default value which i have
fetched from a xml file.. and also i dont want the checked list box to
be disabled, as i want the user to select any item but not change the
checked state.

Thanks in advance guys..
Jul 19 '06 #4

P: n/a
That can be accomplished like this:

Private Sub CheckedListBox1_ItemCheck(ByVal sender As Object, ByVal e
As System.Windows.Forms.ItemCheckEventArgs) Handles
CheckedListBox1.ItemCheck
e.NewValue = e.CurrentValue
End Sub

In the "ItemCheck" Property of the check list box you just reset the
e.NewValue to the e.CurrentValue.

Hope this helps!
am************@gmail.com wrote:
I m using microsoft's checkedlistbox control.. it has builtin checkbox
with every item and i jus wan to disable that checkbox..

cant use datagrids.. ill have to change the control over more then 10
places :(

Izzy wrote:
Are you familiar with Infragistics controls or do you use them?

If so, this is how I would do it:

I would use thier Ultra DataGrid and add 2 columns to it. One is the
description column and the other is the boolean column. Then load your
data and disable editing and set the CellClickActions property of the
grid to RowSelect.

This way they can view and select but not edit.

If you use Microsoft's grid, you can try this method but no guarantees.

am************@gmail.com wrote:
Hi Guys,
>
I have a checked list box on my form.. the purpose of this checkbox is
to indicate that the option is enabled or disabled.. I just want to ask
if there is a way to disable these check boxes from being checked or
unchecked.. i want them to always show their default value which i have
fetched from a xml file.. and also i dont want the checked list box to
be disabled, as i want the user to select any item but not change the
checked state.
>
Thanks in advance guys..
Jul 19 '06 #5

P: n/a
Oops...I should test before I post, the e.NewValue = e.OldValue will
work but it loads the checked list box will everything unchecked. So to
work around that, do this:

Public Class Form1

Private FinishedLoading As Boolean = False

Private Sub CheckedListBox1_ItemCheck(ByVal sender As Object, ByVal
e As System.Windows.Forms.ItemCheckEventArgs) Handles
CheckedListBox1.ItemCheck
'Only perform if the form is finished loading.
If FinishedLoading Then e.NewValue = e.CurrentValue
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
'Load data
CheckedListBox1.Items.Add("test1", True)
CheckedListBox1.Items.Add("test2", True)
CheckedListBox1.Items.Add("test3", False)
CheckedListBox1.Items.Add("test4", False)
CheckedListBox1.Items.Add("test5", True)
CheckedListBox1.Items.Add("test6", True)
CheckedListBox1.Items.Add("test7", False)

'Throw finished loading flag
FinishedLoading = True
End Sub
End Class
All this seems like such a hack to me, I'd just use a datagrid, but
since that's not an option......the above will work.
Izzy wrote:
That can be accomplished like this:

Private Sub CheckedListBox1_ItemCheck(ByVal sender As Object, ByVal e
As System.Windows.Forms.ItemCheckEventArgs) Handles
CheckedListBox1.ItemCheck
e.NewValue = e.CurrentValue
End Sub

In the "ItemCheck" Property of the check list box you just reset the
e.NewValue to the e.CurrentValue.

Hope this helps!
am************@gmail.com wrote:
I m using microsoft's checkedlistbox control.. it has builtin checkbox
with every item and i jus wan to disable that checkbox..

cant use datagrids.. ill have to change the control over more then 10
places :(

Izzy wrote:
Are you familiar with Infragistics controls or do you use them?
>
If so, this is how I would do it:
>
I would use thier Ultra DataGrid and add 2 columns to it. One is the
description column and the other is the boolean column. Then load your
data and disable editing and set the CellClickActions property of the
grid to RowSelect.
>
This way they can view and select but not edit.
>
If you use Microsoft's grid, you can try this method but no guarantees.
>
>
>
am************@gmail.com wrote:
Hi Guys,

I have a checked list box on my form.. the purpose of this checkbox is
to indicate that the option is enabled or disabled.. I just want to ask
if there is a way to disable these check boxes from being checked or
unchecked.. i want them to always show their default value which i have
fetched from a xml file.. and also i dont want the checked list box to
be disabled, as i want the user to select any item but not change the
checked state.

Thanks in advance guys..
Jul 19 '06 #6

P: n/a
Ameen,

Is it not easier for your problem to use a listbox and put in that all the
possibilities while what is not possible is not in that listbox. (You can
even make one where you put something with a string concatenation in)

v Possible
- Not possible
v As well possible

The way you describe it, makes that you have if you have solved this problem
have to find how to find the checkbox that is selected while it is not
selected.

Just my thought,

Cor

<am************@gmail.comschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.com...
Hi Guys,

I have a checked list box on my form.. the purpose of this checkbox is
to indicate that the option is enabled or disabled.. I just want to ask
if there is a way to disable these check boxes from being checked or
unchecked.. i want them to always show their default value which i have
fetched from a xml file.. and also i dont want the checked list box to
be disabled, as i want the user to select any item but not change the
checked state.

Thanks in advance guys..

Jul 20 '06 #7

P: n/a
awesome man.. i worked perfectly :) thanks alot

Izzy wrote:
Oops...I should test before I post, the e.NewValue = e.OldValue will
work but it loads the checked list box will everything unchecked. So to
work around that, do this:

Public Class Form1

Private FinishedLoading As Boolean = False

Private Sub CheckedListBox1_ItemCheck(ByVal sender As Object, ByVal
e As System.Windows.Forms.ItemCheckEventArgs) Handles
CheckedListBox1.ItemCheck
'Only perform if the form is finished loading.
If FinishedLoading Then e.NewValue = e.CurrentValue
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
'Load data
CheckedListBox1.Items.Add("test1", True)
CheckedListBox1.Items.Add("test2", True)
CheckedListBox1.Items.Add("test3", False)
CheckedListBox1.Items.Add("test4", False)
CheckedListBox1.Items.Add("test5", True)
CheckedListBox1.Items.Add("test6", True)
CheckedListBox1.Items.Add("test7", False)

'Throw finished loading flag
FinishedLoading = True
End Sub
End Class
All this seems like such a hack to me, I'd just use a datagrid, but
since that's not an option......the above will work.
Izzy wrote:
That can be accomplished like this:

Private Sub CheckedListBox1_ItemCheck(ByVal sender As Object, ByVal e
As System.Windows.Forms.ItemCheckEventArgs) Handles
CheckedListBox1.ItemCheck
e.NewValue = e.CurrentValue
End Sub

In the "ItemCheck" Property of the check list box you just reset the
e.NewValue to the e.CurrentValue.

Hope this helps!
am************@gmail.com wrote:
I m using microsoft's checkedlistbox control.. it has builtin checkbox
with every item and i jus wan to disable that checkbox..
>
cant use datagrids.. ill have to change the control over more then 10
places :(
>
Izzy wrote:
Are you familiar with Infragistics controls or do you use them?

If so, this is how I would do it:

I would use thier Ultra DataGrid and add 2 columns to it. One is the
description column and the other is the boolean column. Then load your
data and disable editing and set the CellClickActions property of the
grid to RowSelect.

This way they can view and select but not edit.

If you use Microsoft's grid, you can try this method but no guarantees.



am************@gmail.com wrote:
Hi Guys,
>
I have a checked list box on my form.. the purpose of this checkbox is
to indicate that the option is enabled or disabled.. I just want to ask
if there is a way to disable these check boxes from being checked or
unchecked.. i want them to always show their default value which i have
fetched from a xml file.. and also i dont want the checked list box to
be disabled, as i want the user to select any item but not change the
checked state.
>
Thanks in advance guys..
Jul 20 '06 #8

P: n/a
hey Cor, very goood idea :) thanks for the reply..

Cor Ligthert [MVP] wrote:
Ameen,

Is it not easier for your problem to use a listbox and put in that all the
possibilities while what is not possible is not in that listbox. (You can
even make one where you put something with a string concatenation in)

v Possible
- Not possible
v As well possible

The way you describe it, makes that you have if you have solved this problem
have to find how to find the checkbox that is selected while it is not
selected.

Just my thought,

Cor

<am************@gmail.comschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.com...
Hi Guys,

I have a checked list box on my form.. the purpose of this checkbox is
to indicate that the option is enabled or disabled.. I just want to ask
if there is a way to disable these check boxes from being checked or
unchecked.. i want them to always show their default value which i have
fetched from a xml file.. and also i dont want the checked list box to
be disabled, as i want the user to select any item but not change the
checked state.

Thanks in advance guys..
Jul 20 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.