473,386 Members | 1,708 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,386 software developers and data experts.

How to select the first child node of a treeview.

I've tried the following, but keep getting the error "Object reference not
set to an instance of the object."

TreeNode node = tvHistory.Nodes[0].FirstNode;
tvHistory.SelectedNode = node;

I've also tried:
tvHistory.SelectedNode = tvHistory.Nodes[0].FirstNode;

Any suggestions?
Nov 24 '05 #1
1 8491
I found the solution.

I had to put tvHistory.Select() just prior to activate the treeview.
So it now looks like:
sHistory.Select();
sHistory.SelectedNode = sHistory.Nodes[0].Nodes[0];

"Vern" wrote:
I've tried the following, but keep getting the error "Object reference not
set to an instance of the object."

TreeNode node = tvHistory.Nodes[0].FirstNode;
tvHistory.SelectedNode = node;

I've also tried:
tvHistory.SelectedNode = tvHistory.Nodes[0].FirstNode;

Any suggestions?

Nov 24 '05 #2

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

Similar topics

0
by: Aditi Deo via .NET 247 | last post by:
(Type your message here) Hello, Can anyone help me? I have a IE Web control treeview displayed with checkboxes. When I check any treeview node, the child nodes below that node.. should...
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...
2
by: Bob Hollness | last post by:
Hi group. Merry Xmas one and all!!!! I hope Santa brings you all something good. For me, I would be happy with some nice code! If I check a node in a treeview, how do I check all childs of...
2
by: Jack | last post by:
Hello, I am trying use a TreeView with checkboxes. I would like to check more than one node and allow all child nodes of selected nodes to be checked or unchecked with the parent is checked. ...
4
by: praveen | last post by:
I have a form with treeview control loaded from xml document,text box, two buttons named "Find" and "FindNext" and my treeview which looks like below. Details |__ policy status |__ created by...
5
WebDunce
by: WebDunce | last post by:
Hi guys, I am trying to develop a simple xml editor. I have an object that has a TreeView. I use the TreeView to display the Xml node info. That's all fine, but i want the user to be able to move...
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...
0
by: divya1949 | last post by:
Create a windows c# application which will Read a xml file and populate nodes in the treeview. 1 On selection of treenode display the child nodes of that node in listview control 2. ...
4
by: jmDesktop | last post by:
I have searched everywhere and tried several things. I have a treeview with and want to be able to only select a parent node. For example: root //don't want to drag this -parent1 //yes, drag...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...

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.