473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

CheckedListBox Question

Here is some code that I need help with please:

Dim result As New ArrayList
Try
For i = 0 To objecttest1.PersonList.person_returnnumber - 1
result =
objecttest1.PersonList.time_returnpunches(objectte st1.PersonList.person_getb
yid(i).userid, "03/08/2004", "03/09/2004", True, False)
'The above line returns an object with several proerties, namely, a
punch id that I want to be able to get out of the checkedlistbox collection:
For j = 0 To result.Count - 1
If result(j).approval = True Then
CheckedListBox1.Items.Add(result(j).ToString, True)
Else
CheckedListBox1.Items.Add(result(j).ToString, False)
End If
Next
Next
....
End Try

Okay so far...now, I want to find out which object ID's in the
checkedlistbox collection have what state:

Dim item As Object
Dim quote As String = """"
For Each item In CheckedListBox1.Items
MessageBox.Show("Item with id: " + item.GetType.ToString + _ 'Problem
is on this line
" is: " +
CheckedListBox1.GetItemCheckState(CheckedListBox1. Items.IndexOf(item)).ToStr
ing() + ".")
Next

The segment item.GetType.ToString returns System.String which is confusing
me because I think it means that the objects in the checkedlistbox
collection are string objects and not the objects themselves, which would
explain why I can't reference a member of the punch object (id). Is this
correct?

If it is, how can I do this so that I get the object's time property for
each indexed collection? For example, I am wanting:

checkedlistbox1 index = 0 results in this messagebox: Item with ID: 932 is:
unchecked
where '932' is the ID property of the time object that was loaded into the
checkedlistbox

Thanks so much!

Derek
Nov 20 '05 #1
8 1372
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
Here is some code that I need help with please:

Dim result As New ArrayList
Try
For i = 0 To objecttest1.PersonList.person_returnnumber - 1
result =
objecttest1.PersonList.time_returnpunches(objectte st1.PersonList.person_getb yid(i).userid, "03/08/2004", "03/09/2004", True, False)
'The above line returns an object with several proerties,
namely, a
punch id that I want to be able to get out of the checkedlistbox
collection:
For j = 0 To result.Count - 1
If result(j).approval = True Then
CheckedListBox1.Items.Add(result(j).ToString, True)
Else
CheckedListBox1.Items.Add(result(j).ToString, False)
End If
Next
Next
...
End Try

Okay so far...now, I want to find out which object ID's in the
checkedlistbox collection have what state:

Dim item As Object
Dim quote As String = """"
For Each item In CheckedListBox1.Items
MessageBox.Show("Item with id: " + item.GetType.ToString + _
'Problem
is on this line
" is: " +
CheckedListBox1.GetItemCheckState(CheckedListBox1. Items.IndexOf(item)).ToStr ing() + ".")
Next

The segment item.GetType.ToString returns System.String which is
confusing me because I think it means that the objects in the
checkedlistbox collection are string objects and not the objects
themselves, which would explain why I can't reference a member of the
punch object (id). Is this correct?
Right
If it is, how can I do this so that I get the object's time property
for each indexed collection? For example, I am wanting:

checkedlistbox1 index = 0 results in this messagebox: Item with ID:
932 is: unchecked
where '932' is the ID property of the time object that was loaded
into the checkedlistbox


As you didn't add the objects to the listbox, only a string, there is no
relation to the original object.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
Here is some code that I need help with please:

Dim result As New ArrayList
Try
For i = 0 To objecttest1.PersonList.person_returnnumber - 1
result =
objecttest1.PersonList.time_returnpunches(objectte st1.PersonList.person_getb yid(i).userid, "03/08/2004", "03/09/2004", True, False)
'The above line returns an object with several proerties,
namely, a
punch id that I want to be able to get out of the checkedlistbox
collection:
For j = 0 To result.Count - 1
If result(j).approval = True Then
CheckedListBox1.Items.Add(result(j).ToString, True)
Else
CheckedListBox1.Items.Add(result(j).ToString, False)
End If
Next
Next
...
End Try

Okay so far...now, I want to find out which object ID's in the
checkedlistbox collection have what state:

Dim item As Object
Dim quote As String = """"
For Each item In CheckedListBox1.Items
MessageBox.Show("Item with id: " + item.GetType.ToString + _
'Problem
is on this line
" is: " +
CheckedListBox1.GetItemCheckState(CheckedListBox1. Items.IndexOf(item)).ToStr ing() + ".")
Next

The segment item.GetType.ToString returns System.String which is
confusing me because I think it means that the objects in the
checkedlistbox collection are string objects and not the objects
themselves, which would explain why I can't reference a member of the
punch object (id). Is this correct?
Right
If it is, how can I do this so that I get the object's time property
for each indexed collection? For example, I am wanting:

checkedlistbox1 index = 0 results in this messagebox: Item with ID:
932 is: unchecked
where '932' is the ID property of the time object that was loaded
into the checkedlistbox


As you didn't add the objects to the listbox, only a string, there is no
relation to the original object.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Thanks for teh reply...Okay, so how can I add the object itself to the
checkedlistbox?

Thanks!
Derek

"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de...
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
Here is some code that I need help with please:

Dim result As New ArrayList
Try
For i = 0 To objecttest1.PersonList.person_returnnumber - 1
result =

objecttest1.PersonList.time_returnpunches(objectte st1.PersonList.person_getb
yid(i).userid, "03/08/2004", "03/09/2004", True, False)
'The above line returns an object with several proerties,
namely, a
punch id that I want to be able to get out of the checkedlistbox
collection:
For j = 0 To result.Count - 1
If result(j).approval = True Then
CheckedListBox1.Items.Add(result(j).ToString, True)
Else
CheckedListBox1.Items.Add(result(j).ToString, False)
End If
Next
Next
...
End Try

Okay so far...now, I want to find out which object ID's in the
checkedlistbox collection have what state:

Dim item As Object
Dim quote As String = """"
For Each item In CheckedListBox1.Items
MessageBox.Show("Item with id: " + item.GetType.ToString + _
'Problem
is on this line
" is: " +

CheckedListBox1.GetItemCheckState(CheckedListBox1. Items.IndexOf(item)).ToStr
ing() + ".")
Next

The segment item.GetType.ToString returns System.String which is
confusing me because I think it means that the objects in the
checkedlistbox collection are string objects and not the objects
themselves, which would explain why I can't reference a member of the
punch object (id). Is this correct?


Right
If it is, how can I do this so that I get the object's time property
for each indexed collection? For example, I am wanting:

checkedlistbox1 index = 0 results in this messagebox: Item with ID:
932 is: unchecked
where '932' is the ID property of the time object that was loaded
into the checkedlistbox


As you didn't add the objects to the listbox, only a string, there is no
relation to the original object.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
Thanks for teh reply...Okay, so how can I add the object itself to the
checkedlistbox?

Thanks!
Derek

"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de...
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
Here is some code that I need help with please:

Dim result As New ArrayList
Try
For i = 0 To objecttest1.PersonList.person_returnnumber - 1
result =

objecttest1.PersonList.time_returnpunches(objectte st1.PersonList.person_getb
yid(i).userid, "03/08/2004", "03/09/2004", True, False)
'The above line returns an object with several proerties,
namely, a
punch id that I want to be able to get out of the checkedlistbox
collection:
For j = 0 To result.Count - 1
If result(j).approval = True Then
CheckedListBox1.Items.Add(result(j).ToString, True)
Else
CheckedListBox1.Items.Add(result(j).ToString, False)
End If
Next
Next
...
End Try

Okay so far...now, I want to find out which object ID's in the
checkedlistbox collection have what state:

Dim item As Object
Dim quote As String = """"
For Each item In CheckedListBox1.Items
MessageBox.Show("Item with id: " + item.GetType.ToString + _
'Problem
is on this line
" is: " +

CheckedListBox1.GetItemCheckState(CheckedListBox1. Items.IndexOf(item)).ToStr
ing() + ".")
Next

The segment item.GetType.ToString returns System.String which is
confusing me because I think it means that the objects in the
checkedlistbox collection are string objects and not the objects
themselves, which would explain why I can't reference a member of the
punch object (id). Is this correct?


Right
If it is, how can I do this so that I get the object's time property
for each indexed collection? For example, I am wanting:

checkedlistbox1 index = 0 results in this messagebox: Item with ID:
932 is: unchecked
where '932' is the ID property of the time object that was loaded
into the checkedlistbox


As you didn't add the objects to the listbox, only a string, there is no
relation to the original object.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
Figured it out:
When adding it into the list, force the object itself to be added and
overload the tostring method in the object class.

:-)
Thanks!
Derek
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Thanks for teh reply...Okay, so how can I add the object itself to the
checkedlistbox?

Thanks!
Derek

"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de...
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
Here is some code that I need help with please:

Dim result As New ArrayList
Try
For i = 0 To objecttest1.PersonList.person_returnnumber - 1
result =

objecttest1.PersonList.time_returnpunches(objectte st1.PersonList.person_getb
yid(i).userid, "03/08/2004", "03/09/2004", True, False)
'The above line returns an object with several proerties,
namely, a
punch id that I want to be able to get out of the checkedlistbox
collection:
For j = 0 To result.Count - 1
If result(j).approval = True Then
CheckedListBox1.Items.Add(result(j).ToString, True)
Else
CheckedListBox1.Items.Add(result(j).ToString, False)
End If
Next
Next
...
End Try

Okay so far...now, I want to find out which object ID's in the
checkedlistbox collection have what state:

Dim item As Object
Dim quote As String = """"
For Each item In CheckedListBox1.Items
MessageBox.Show("Item with id: " + item.GetType.ToString + _
'Problem
is on this line
" is: " +

CheckedListBox1.GetItemCheckState(CheckedListBox1. Items.IndexOf(item)).ToStr
ing() + ".")
Next

The segment item.GetType.ToString returns System.String which is
confusing me because I think it means that the objects in the
checkedlistbox collection are string objects and not the objects
themselves, which would explain why I can't reference a member of the
punch object (id). Is this correct?


Right
If it is, how can I do this so that I get the object's time property
for each indexed collection? For example, I am wanting:

checkedlistbox1 index = 0 results in this messagebox: Item with ID:
932 is: unchecked
where '932' is the ID property of the time object that was loaded
into the checkedlistbox


As you didn't add the objects to the listbox, only a string, there is no
relation to the original object.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


Nov 20 '05 #6
Figured it out:
When adding it into the list, force the object itself to be added and
overload the tostring method in the object class.

:-)
Thanks!
Derek
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Thanks for teh reply...Okay, so how can I add the object itself to the
checkedlistbox?

Thanks!
Derek

"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de...
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
Here is some code that I need help with please:

Dim result As New ArrayList
Try
For i = 0 To objecttest1.PersonList.person_returnnumber - 1
result =

objecttest1.PersonList.time_returnpunches(objectte st1.PersonList.person_getb
yid(i).userid, "03/08/2004", "03/09/2004", True, False)
'The above line returns an object with several proerties,
namely, a
punch id that I want to be able to get out of the checkedlistbox
collection:
For j = 0 To result.Count - 1
If result(j).approval = True Then
CheckedListBox1.Items.Add(result(j).ToString, True)
Else
CheckedListBox1.Items.Add(result(j).ToString, False)
End If
Next
Next
...
End Try

Okay so far...now, I want to find out which object ID's in the
checkedlistbox collection have what state:

Dim item As Object
Dim quote As String = """"
For Each item In CheckedListBox1.Items
MessageBox.Show("Item with id: " + item.GetType.ToString + _
'Problem
is on this line
" is: " +

CheckedListBox1.GetItemCheckState(CheckedListBox1. Items.IndexOf(item)).ToStr
ing() + ".")
Next

The segment item.GetType.ToString returns System.String which is
confusing me because I think it means that the objects in the
checkedlistbox collection are string objects and not the objects
themselves, which would explain why I can't reference a member of the
punch object (id). Is this correct?


Right
If it is, how can I do this so that I get the object's time property
for each indexed collection? For example, I am wanting:

checkedlistbox1 index = 0 results in this messagebox: Item with ID:
932 is: unchecked
where '932' is the ID property of the time object that was loaded
into the checkedlistbox


As you didn't add the objects to the listbox, only a string, there is no
relation to the original object.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


Nov 20 '05 #7
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
Thanks for teh reply...Okay, so how can I add the object itself to
the checkedlistbox?


CheckedListBox1.Items.Add(result(j))

The listbox displays the result of the object's ToString function.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #8
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
Thanks for teh reply...Okay, so how can I add the object itself to
the checkedlistbox?


CheckedListBox1.Items.Add(result(j))

The listbox displays the result of the object's ToString function.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: | last post by:
David, A partial answer to your question: The 'MultiColumn' property of a CheckedListBox does not cause it to display multiple FIELDS of an item... it causes it to display the items...
4
by: Reza | last post by:
Hi, I want to check one of the memebrs of a checkedListbox based on its value. I 'm getting a number(say 1355) from another control and based on that number I want to check an item which its...
2
by: CC | last post by:
Hi, We are populating a CheckedListBox from a database. Based on a selection by the user, the CheckedListBox either contains ALL possible members of a set, or a subset of possible members. The...
8
by: Derek Martin | last post by:
Here is some code that I need help with please: Dim result As New ArrayList Try For i = 0 To objecttest1.PersonList.person_returnnumber - 1 result =...
2
by: Manuel Canas | last post by:
Hi there, I'm having this dilema with a checkedlistbox. I have an array of items in there, what I want to accomplish is the following; The user could check all the items in the...
4
by: Moondog | last post by:
Simple question: How can I test if an item has been checked in a CheckedListBox? My scenario is if a user clicks on my CheckedListBox, and the item has not been checked yet, do some event, if...
0
by: Terry Olsen | last post by:
Dim dirs() as string = Directory.GetDirectories(MyPath) CheckedListBox.DataSource = dirs CheckedListBox.Update For I as Integer = 0 To CheckedListBox.Items.Count - 1...
5
by: mabond | last post by:
Hi Can't believe I've not been able to find the answer to this in the on-line help. I have a CheckedListBox which, via a timer control, is populated with the names of files in a network...
6
by: Steve Teeples | last post by:
Can someone show me an example of how to place a "CheckedListBox" property within a PropertyGrid? -- ----------- Thanks, Steve
2
by: bh | last post by:
In the Listbox, there are properties for DisplayMember and ValueMember, just like the combobox, however, those properties are not present for the CheckedListBox. Does this mean that the only...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.