473,503 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Treeview Refresh - Strange Behavior

Hello all,

I am populating my treeview with only 1 level of items. Upon opening my
screen, I call the RefreshTreeview routine which populates the treeview just
fine, and I am able to click on nodes in the treeview and populate the
appropriate data accordingly. However, once I add a new record via this
screen and call the same RefreshTreeview routine (which successfully
populates the treeview with the appropriate items including the new one just
added) - the treeview gives me an error upon clicking any node: "Object
reference not set to an instance of an object.", when I am attempting to grab
the tvwROS.SelectedNode.Text (just as I did before upon opening of the screen
which did not error)...

This is stumping me... please help!!! :)
-Valerie

Routine is below:
Private Sub RefreshTreeview()

Dim sSQL As String
Dim rsRecordset As ADODB.Recordset
Dim iIndex As Integer
Dim sROSSystem As String
Dim lROSID As Long

'Clear Treeview
tvwROS.Nodes.Clear()
iIndex = -1

sSQL = "SELECT ROSID, ROSSystemDS FROM vwROS WHERE VisitID = " &
glVisitID
rsRecordset = gdcDataConnection.Execute(sSQL)

With rsRecordset
If Not (.BOF And .EOF) Then
While Not .EOF
iIndex = iIndex + 1
sROSSystem = rsRecordset("ROSSystemDS").Value
lROSID = rsRecordset("ROSID").Value
tvwROS.Nodes.Add(sROSSystem)
tvwROS.Nodes.Item(iIndex).Tag = lROSID
.MoveNext()
End While
.Close()
End If
End With

mbIsDirty = False
btnSave.Enabled = False

End Sub
Nov 21 '05 #1
0 3106

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

Similar topics

0
1108
by: Dan | last post by:
Hi, We are currently experiencing a pretty strange behavior with TreeView control that comes with IE webcontrols. Actually when used on OS other than XP, everything works fine but when it is use...
6
20042
by: Brian Smith | last post by:
Is there a way to avoid the default action of TreeNode expansion/contraction caused by double click? I can add an event handler to pop up my properties dialog on double click, but it has the...
8
4391
by: Hrvoje Voda | last post by:
What is wrong in this code? private void tree_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter ) {
4
1861
by: solex | last post by:
Hello, I am in the process of converting a project from VB6 to DotNet and have noticed that some strange behavior with the TreeView Control (1) when setting the NodeFont property to Bold I...
1
2417
by: Larax | last post by:
Alright, so here's the problem. I define a global variable in my script and then add methods/properties to it. Everything works great, no error in Javascript Console. But when I refresh site,...
0
1470
by: Christof Nordiek | last post by:
Hi, Below is a simple program that demonstrates my poblem. i fill a treeview with nine nodes. Then the treeview is shown with a scrollbar. But I can't scroll to the last item. scrolling to the...
0
3397
by: drop | last post by:
Hi, I am using a Treeview and I'd like to know what is the best way to refresh the children of a specific node in the treeview. I already do that using full postback, but this sends back the...
2
2903
by: =?Utf-8?B?QW1pciBUb2hpZGk=?= | last post by:
Hi I have a web page that has a TreeView on it. If I DONT'T expand the TreeView nodes, the auto refresh works nicely: my page gets refreshed every minute. As soon as I expand a node on the...
5
2023
by: Peter Duniho | last post by:
On Sat, 27 Sep 2008 12:02:04 -0700, <timor.super@gmail.comwrote: You don't, not when you don't know that one event is necessarily going to follow another. If the events can appear alone, then...
0
7093
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
7287
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,...
1
7008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7467
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
5594
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
3177
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
1521
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 ...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.