473,836 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Treeview

Dim objNode As MSComctlLib.Nod e
TreeView1.Image List = 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 7496
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****@discuss ions.microsoft. com> wrote in message
news:31******** *************** ***********@mic rosoft.com...
Dim objNode As MSComctlLib.Nod e
TreeView1.Image List = 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.C ontrol.

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****@discuss ions.microsoft. com> wrote in message
news:31******** *************** ***********@mic rosoft.com...
Dim objNode As MSComctlLib.Nod e
TreeView1.Image List = 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
11567
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
19901
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 dynamic menu by collating data from a Sql Server Table. Many thanks.
1
6685
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 adding a ImageList to the TreeView, the ImageIndex property of the items in the TreeView defaults to 0. I could put a blank icon in the ImageList and make it the 0 index image, however, this makes an ugly space. Would I have to create my own...
3
2839
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%"" BORDER=""0"" CELLSPACING=""0"" CELLPADDING=""0"" ID=""Table1""> " & vbNewLine) writer.Write(" <tr>" & vbNewLine) writer.Write(" <td>" & vbNewLine)
6
4936
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. However, either it only add it to the root level or it only add it on level below, doesn't matter what I select. And in some case, I just get an exception.
14
15106
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
3835
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"); dbTree.Nodes.Add(dbTreeRoot); .. ..
2
7504
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 nodes. The TreeView populates dynamically as there are a significant number of nodes. The DataGrid displays both the items and the nodes from the TreeView. Using the explorer analogy this means the TreeView shows folders, and the DataGrid folders...
1
693
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 Treeview event I am dynamically trying to load the child nodes to the exisisting TreeView. The problem is since the TreeView is being loaded on not a Postback, I am unable to refer to any node in the TreeView event. Can anybody tell me how to...
8
12788
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 form. I only want to allow single selection, so using checkboxes is out of the question. It works as is, but it makes the form very cumbersome if every time that a user selects a node, the whole page has to reload. Is there a way to have a node...
0
9658
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10828
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10579
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10244
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9364
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7775
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6975
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5644
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.