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

Treeview

Dim objNode As MSComctlLib.Node
TreeView1.ImageList = ImageList1 'Assign the image list to TreeView
Set objNode = TreeView1.Nodes.Add() 'Create the Server Node

I need to conver the above VB 6.0 code to VB .NET.

Set objNode = TreeView1.Nodes.Add() changes to
objNode = TreeView1.Nodes.Add()

but iam getting an error that add has wrong number of arguments and if i add
some argument it says "Error 91: object reference not set to an instance of
an object"

PLEASE HELP.
thank you
Nov 21 '05 #1
6 7410
Hi,
Treeview.Nodes.Add does not return a treenode. Try something like
this instead.

Dim objNode as Treenode

objNode = new TreeNode("New Nodes Text")

treeview1.nodes.add(objNode)

Ken
-------------------------
"amruta" <am****@discussions.microsoft.com> wrote in message
news:31**********************************@microsof t.com...
Dim objNode As MSComctlLib.Node
TreeView1.ImageList = ImageList1 'Assign the image list to TreeView
Set objNode = TreeView1.Nodes.Add() 'Create the Server Node

I need to conver the above VB 6.0 code to VB .NET.

Set objNode = TreeView1.Nodes.Add() changes to
objNode = TreeView1.Nodes.Add()

but iam getting an error that add has wrong number of arguments and if i add
some argument it says "Error 91: object reference not set to an instance of
an object"

PLEASE HELP.
thank you
Nov 21 '05 #2
Amruta,

I assume that you are trying to convert the VB 6.0 code to VB.NET by yourself.

If you want you can use the Upgrade wizard that will automatically migrate
the VB 6.0 code to VB.NET. However one limitation of doing it this way is
that you will be stuck with the old ActiveX Treeview control. Since you are
upgrading your application you might want to take advantage of the
Windows.Forms.Control.

I would suggest that you use the upgrade wizard and then manually migrate
the treeview if you feel like.

In VB.NET syntax the code for what you are trying to do would be
///
Dim objNode as TreeNode
objNode = Treeview1.Nodes.Add("")
\\\

HTH
Nov 21 '05 #3
Both ur replies helped.

I had few more questions...

how to I get a image for the node in the treeview.

how do i expand and collapse nodes in the treeview.

Thank you very much for your help.

"Ken Tucker [MVP]" wrote:
Hi,
Treeview.Nodes.Add does not return a treenode. Try something like
this instead.

Dim objNode as Treenode

objNode = new TreeNode("New Nodes Text")

treeview1.nodes.add(objNode)

Ken
-------------------------
"amruta" <am****@discussions.microsoft.com> wrote in message
news:31**********************************@microsof t.com...
Dim objNode As MSComctlLib.Node
TreeView1.ImageList = ImageList1 'Assign the image list to TreeView
Set objNode = TreeView1.Nodes.Add() 'Create the Server Node

I need to conver the above VB 6.0 code to VB .NET.

Set objNode = TreeView1.Nodes.Add() changes to
objNode = TreeView1.Nodes.Add()

but iam getting an error that add has wrong number of arguments and if i add
some argument it says "Error 91: object reference not set to an instance of
an object"

PLEASE HELP.
thank you

Nov 21 '05 #4
Check out the Treeview documentatio
http://msdn.microsoft.com/library/de...oloverview.asp

HTH

Nov 21 '05 #5
HI,
how do I set a node as parent node?

objnode.parent = .....

it says parent is readonly ...
also not able to expand and collapse.

what is equivalent to KEY?

"Sarika" wrote:
Check out the Treeview documentation
http://msdn.microsoft.com/library/de...oloverview.asp

HTH

Nov 21 '05 #6
There is no equivalent to the Key property of the older treeview. You could
use the Tag property instead.

Yes that property is a readonly property. A node becomes a parent node if
you add nodes to it.

I would suggest that you read the documentation to understand the concepts.

HTH
Nov 21 '05 #7

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

Similar topics

42
by: lauren quantrell | last post by:
So many postings on not to use the treeview control, but nothing recently. Is it safe to swim there yet with Access 2000-Access 2003?
5
by: SoKool | last post by:
Can anyone point me to a site where I can get a free treeview control to use in ASP .NET or any tutorial that can help me build my own treeview control. I intend to use a treeview to generate a...
1
by: paradox | last post by:
I want to have a TreeView that shows an image on some items, but not all. Basically, if a certain condition is true, a caution icon is placed next to the treeview item. The problem is that, by...
3
by: Peter | last post by:
Hello, We are inserting a side menu to our application using a class that is writing HTML on all our pages. This is a part of the code as an example: writer.Write(" <table WIDTH=""100%""...
6
by: L.M | last post by:
Hello, I knew how to use the treeview under VB6. After migrating to .NET, well, I'm lost. I try to add a new node, either to the same level or as a child to a selected node in the treeview....
14
by: Mr.D | last post by:
How do I save/load the contents of a Treeview to a file? I have found several good examples written i VB6, but not a single one for VB.NET. Please help. ---- Tim
3
by: christof | last post by:
I've got a really easy problem, please help me: There are two pages in one I'm creating a TreeView like that: TreeView dbTree = new TreeView(); TreeNode dbTreeRoot = new TreeNode("Root");...
2
by: Tymbow | last post by:
I'm building a web application that is analogous to the Windows XP file explorer in function. The left column contains a TreeView, and the right column a DataGrid populated by selecting TreeView...
1
by: kvicky | last post by:
I am trying to load child nodes to a TreeNode in a TreeView in a ASP.net web application. The Treeview with parent nodes are loaded on a Page_load while doing if( ! ISPostback ) and then in the...
8
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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...

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.