New topic: 

ListBox with check boxes in the list

<http://forums.realsoftware.com/viewtopic.php?t=43873>

  Page 1 of 1
 [ 3 posts ]  Previous topic | Next topic AuthorMessagevkozme Post subject: 
ListBox with check boxes in the listPosted: Fri May 04, 2012 12:16 am 
Joined: Fri Oct 21, 2005 7:51 pm
Posts: 218 Hi, guys,

I have a checklist with check boxes in the list. How can I count the number of 
checked items?

Is there a way to sum the numbers in the column 2 of all checked items in the 
list?

Thank you.

vkozme
Top  amitavak Post subject: Re: ListBox with check boxes in the listPosted: Fri 
May 04, 2012 12:52 am 
Joined: Mon Jan 02, 2012 1:51 am
Posts: 192 I think you can loop through the listbox row and check the state of 
the checkbox in a specific column using "CellCheck" property of the listBox. 
After reading the post, I tried in my computer and this code works for me. In a 
button click, I wrote

Dim i, count As Integer

For i =0 To Listbox1.ListCount - 1
  If Listbox1.CellCheck(i, 0) Then
  count = count + 1
  End If
  
Next

MsgBox "Check count : " + Str(count)


I put the checkBox in 0th column.
_________________
Amitava
Real Studio 2011 Release 4
Windows 7 (32 bit)
Top  vkozme Post subject: Re: ListBox with check boxes in the listPosted: Fri 
May 04, 2012 6:38 am 
Joined: Fri Oct 21, 2005 7:51 pm
Posts: 218 Thank you, it is working like a charm.
Top  Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 
months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1
 [ 3 posts ] 
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to