﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » checked listbox question</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Thu, 24 Sep 2026 04:48:37 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: checked listbox question</title><link>http://forum.strataframe.net/FindPost7764.aspx</link><description>This is just standard ListView behavior and we do not add any additional functionality here.&amp;nbsp; But to use a checked list view, just set the CheckBoxes property to True.&amp;nbsp; Then to set a ListView checked item it would just be setting the Checked property of the ListVIew item.&lt;/P&gt;&lt;P&gt;[codesnippet]MyListView.Items(0).Checked = True[/codesnippet]&lt;/P&gt;&lt;P&gt;You can also referenced the CheckedItems collection to see which items have been checked rather than having to cycle through the Items collection and testing:&lt;/P&gt;&lt;P&gt;[codesnippet]Dim loItem As ListViewItem&lt;/P&gt;&lt;P&gt;For Each loItem IN MyListView.CheckedItems&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Place your code here to do something with the checked item&lt;BR&gt;Next[/codesnippet]</description><pubDate>Wed, 28 Mar 2007 13:13:18 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>checked listbox question</title><link>http://forum.strataframe.net/FindPost4855.aspx</link><description>I cannot seem to&amp;nbsp;get this right&amp;nbsp;but it has been a long week:)&lt;/P&gt;&lt;P&gt;I have 3 tables&lt;/P&gt;&lt;P&gt;Jobsite - contains info about a job &lt;/P&gt;&lt;P&gt;Equipment - contains a list of equipment (shovels,hard hats&amp;nbsp;etc)&lt;/P&gt;&lt;P&gt;JsEquipment link table for first 2 tables contains a Pk and 2 FK's from each above tables&amp;nbsp;JSE_PK,JBS_FK,EQP_FK&lt;/P&gt;&lt;P&gt;I want to use a checked listbox to allow the user to select which equipment needs to be used on the job. Can you give me a rundown on how to set up the checked listbox. I have tried but failed..:D&amp;nbsp;By the way all the primary and foreign keys are guid's&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;P</description><pubDate>Wed, 28 Mar 2007 13:13:18 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: checked listbox question</title><link>http://forum.strataframe.net/FindPost7763.aspx</link><description>I got it, its just like ListView pretty much with a CheckedItems collection.....&lt;br&gt;
&lt;br&gt;</description><pubDate>Wed, 28 Mar 2007 13:08:41 GMT</pubDate><dc:creator>Keith Chisarik</dc:creator></item><item><title>RE: checked listbox question</title><link>http://forum.strataframe.net/FindPost7762.aspx</link><description>Any examples or sample code for checked listview control around?&lt;br&gt;
&lt;br&gt;
I checked the documentation but all it seems to have is member/property definitions.&lt;br&gt;
&lt;br&gt;
I checked the sample apps and could not find anything.&lt;br&gt;
&lt;br&gt;
All I want to do is populate the listview from a single table/colum and allow the user to select some. I don't want it bound back to the table, so if I can just read the "checked" selections and be done that is the desire. Does it try to persist the values back to a field in your datasource? I can only imagine it does since it uses PopulationDataSourceSettings.....&lt;br&gt;
&lt;br&gt;</description><pubDate>Wed, 28 Mar 2007 12:34:08 GMT</pubDate><dc:creator>Keith Chisarik</dc:creator></item><item><title>RE: checked listbox question</title><link>http://forum.strataframe.net/FindPost4872.aspx</link><description>It's OK to drive on the wrong side of the road sometimes... just as long as your steering wheel is still on the correct side and you don't have to shift with your left hand :)</description><pubDate>Thu, 30 Nov 2006 09:59:23 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: checked listbox question</title><link>http://forum.strataframe.net/FindPost4871.aspx</link><description>Thanks Ben that helps alot. I was driving on the wrong side of the road again:)&lt;/P&gt;&lt;P&gt;P</description><pubDate>Thu, 30 Nov 2006 09:43:16 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: checked listbox question</title><link>http://forum.strataframe.net/FindPost4864.aspx</link><description>You'll want to select all of the items from the JsEquipment table and populate the checked list box off of that.&amp;nbsp; When you build the list, you'll want to do one of 2 things: &lt;/P&gt;&lt;P&gt;1) do a left join of the JsEquipment on the link table so that you can tell what should be checked (if the field is NULL then it should be unchecked, otherwise, it should be checked)&lt;/P&gt;&lt;P&gt;2) you can add all of the nodes to a dictionary (System.Collections.Generic.Dictionary(Of Guid, TreeNode)) so you can access all of the tree nodes later by their primary key.&amp;nbsp; After you have the list populated, you will then need to be set the checked state on the nodes to their initial state... that's why you need the dictionary.&amp;nbsp; Do a join on the link table and cycle through the returned records calling TreeView.SetNodeState(Dictionary(LinkBO.EquipmentFK), True) to check them.&lt;/P&gt;&lt;P&gt;When you want to set the state of a node, you can use SetNodeState(node, true/false), which will set the checked state of the parent/child nodes as well.&amp;nbsp; Don't forget to store off the GuidPK of the piece of equipment in the tag of the node.&lt;/P&gt;&lt;P&gt;Once you have the list populated, you can use the NodeStateChanged event handler... do a .Seek() within the link table and either add or remove a record from the link table depending upon whether the node is checked or unchecked.</description><pubDate>Thu, 30 Nov 2006 09:20:31 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>