473,466 Members | 1,389 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Treeview and hashtables

16 New Member
I have treeview with checkboxes on it and need to update the database(if unchecked) and insert into the database(if checked) in my button click sub routine. I'm using a hashtable to avoid having 'duplicate keys' in run time. I'm obviously doing something very wrong because the code jumps straight from the 'For each' statement to the 'End Sub' line.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdUpdate_Click(ByVal sender as System.Object, ByVal e as System.EventArgs) Handles cmdUpdate.Click
  2.  
  3. Dim sUpdate as String = ""
  4. Dim node as TreeNode
  5.  
  6. For each node in tvQuestions.Nodes
  7.     If node.checked Then
  8.         If node.text = htxref.item(tvQuestions.SelectedNode) Then
  9.            sUpdate = "Update............" 'actual SQL statement too long for here
  10.         Else
  11.            sUpdate = "Insert......" 'actual SQL statement too long for here
  12.         End if
  13.     End if
  14. Next
  15.  
  16. 'SQL execution statements here'
  17. End Sub
  18.  
Jun 10 '09 #1
1 1634
mzmishra
390 Recognized Expert Contributor
try to use TreeNodeCollection
TreeNodeCollection nodes = treeView.Nodes;
foreach (TreeNode n in nodes)
{
}
Jun 16 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Michael Schollmeyer | last post by:
Hello, The following code writes the text string: Uri uri1 = new Uri("http://www.here.net/aplace?param=one"); Uri uri2 = new Uri("http://www.here.net/aplace?param=two"); int h1 =...
13
by: Anders Borum | last post by:
Hello! Now that generics are introduces with the next version of C#, I was wondering what kind of performance gains we're going to see, when switching from e.g. the general hashtable to a...
4
by: Anders Borum | last post by:
Hello! I have a list of singleton classes (model managers) that store objects internally using hashtables. Each of these classes use a single hashtable to store e.g. users, pages, elements and...
13
by: André Nogueira | last post by:
Hi there. I know you can view a node's fullpath property, but is it posible to select a node using its path? Like, tell the treeview that the node that should be selected is the node with the...
1
by: Curtis | last post by:
Does anyone know the proper method to save information to embedded hashtables. I am trying to save parent/child information to hashtables but I am not getting the correct results I have made a...
2
by: PAzevedo | last post by:
I have this Hashtable of Hashtables, and I'm accessing this object from multiple threads, now the Hashtable object is thread safe for reading, but not for writing, so I lock the object every time I...
2
by: Luqman | last post by:
I have filled a treeview with parents and childs, using Hashtables. Now, how can I check the required Parent and its Child Nodes. for example, I have following data Group Item A Item A1...
7
by: Kamran Shafi | last post by:
Hi, I am creating an arraylist (say masterArrayList) of hashtables, where each hashtable (say table) is of the format key=string, value = arraylist of strings (say existing_strings). In a...
7
by: Mike P | last post by:
I have 2 hashtables each of which I am using to store a set of IDs and Descriptions. Hashtable 1 will have the full set of data (e.g. IDs 1,2,3,4,5) whereas Hashtable 2 will only have a subset of...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.