473,800 Members | 2,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB.net TreeView won't display on my form?

2 New Member
Hi all - I'm kind of a newbie. I've been researching this problem for a couple of days now and my searches haven't really come up with any solutions - hopefully I'm just doing something silly and someone will be able to point it out to me!

I'm working with a dataset - which is separated from the rest of the program by a datamanager class I made.

My form calls the datamanager class function that will call the function in the dataset to create a treeview based on the relational data in my dataset.

When the treeview is returned to the original sub that call it in the form I can see that all of the nodes are still intact - but nothing displays on the form?


Here's the code under the form load event:
Dim i As Integer
songTree.Nodes. Clear()
For i = 0 To My.Application. DataManager.get SongTree().Node s.Count - 1
songTree.Nodes. Add(My.Applicat ion.DataManager .getSongTree(). Nodes(i))
Next

songTree.Show()

Here's the code in my dataset:
Public Function gettreenode() As Windows.Forms.T reeView
Dim songTree As New Windows.Forms.T reeView
Dim nodeBand, nodeAlbum, nodeSong As New Windows.Forms.T reeNode
Dim rowBand, rowbandstoalbum s, rowAlbum, rowSong As DataRow

For Each rowBand In Me.Tables("Band s").Rows

nodeBand = New Windows.Forms.T reeNode
nodeBand.Text = rowBand("BandNa me")
nodeBand.Tag = rowBand
nodeBand = songTree.Nodes. Add(rowBand("Ba ndName"))
nodeBand.Tag = rowBand

songTree.Nodes. Add(nodeBand)

For Each rowbandstoalbum s In rowBand.GetChil dRows("BandAlbu msBand")
rowAlbum = rowbandstoalbum s.GetParentRow( "AlbumBandsAlbu ms")

nodeAlbum = nodeBand.Nodes. Add(rowAlbum("A lbumTitle"))
nodeAlbum.Tag = rowAlbum
nodeBand.Nodes. Add(nodeAlbum)

For Each rowSong In rowAlbum.GetChi ldRows("SongsAl bums")
nodeSong = nodeAlbum.Nodes .Add(rowSong("S ongTitle"))
nodeSong.Tag = rowSong
nodeAlbum.Nodes .Add(nodeSong)

Next
Next
Next

Return songTree
End Function

Any ideas?
Thanks!
Apr 14 '07 #1
3 1802
iburyak
1,017 Recognized Expert Top Contributor
I didn't test it but do you have something like tree.refresh property?

Sometimes Microsoft tree nodes disappear but it is enough to move scrollbar up and down for them to show up again.
Apr 15 '07 #2
WISara
2 New Member
I've tried

tree.refresh
tree.visible = true


neither have any effect....
Apr 15 '07 #3
iburyak
1,017 Recognized Expert Top Contributor
Step through your code again it looks to me that function gettreenode loads tree directly and you don’t need to load it again in form load.

Use songTree.Show() before load it might help visualize on what is going on. You can remove this after it’ll start working as intended.

With a loop below you duplicate each node that already loaded by a function. Maybe it is better just to pass a tree as an object to your function and load it as you do but once.

Expand|Select|Wrap|Line Numbers
  1. For i = 0 To My.Application.DataManager.getSongTree().Nodes.Count - 1
  2.    songTree.Nodes.Add(My.Application.DataManager.getSongTree().Nodes(i))
  3. Next
  4.  
Maybe I am wrong, it is hard to judge without testing.

Good Luck.
Apr 15 '07 #4

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

Similar topics

42
11559
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?
1
3691
by: sho_nuff | last post by:
Hello, It appears that i may need to create a custom treeview. I have a set of nodes - sometimes, if a user selects an option , i may want to only display a subset of those nodes... and i don't want to have to create a new treeview every time. is it possible to just override the paint method for a treeview to loop through my custom nodes and check some display boolean before making the node visible to my user?
1
5217
by: Terry | last post by:
I've seen several posts from people who have seen this flashing in TreeView's when resizing a form. I've noticed it in my app, but only in the child windows. For example, my main form has a splitter with a TreeView and I do not get the flickering with it. I created a new Form based Windows app. Added a TreeView (dock left), then a splitter and a property grid on the right (dock fill). For this test, I added a panel and button at the...
0
1783
by: Björn Bengtsson | last post by:
Hello! I have an urgent problem concerning ASP.NET, ADO.NET, SQL Server, XML and the TreeView control. I have two tables; one describing the products and one describing their relationships. A product may consist of multiple other products. So far everything is great. But one product may exist as a subproduct to multiple parent products. My tables:
2
2053
by: Irishmaninusa | last post by:
Hello, I am a newbie to asp.net and I am trying to do sample code using the treeview code, and for some reason it is not displaying the way I would expect it to display. HEre is the code in question <%@ Import Namespace="Microsoft.Web.UI.WebControls" %> <%@ Register TagPrefix="IE" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls" %>
6
4373
by: Jarod_24 | last post by:
This is the exception i'm getting: System.InvalidOperationException: The action being performed on this control is being called from the wrong thread. You must marshal to the correct thread using Control.Invoke or Control.BeginInvoke to perform this action. I have multiple background-threads that returns info about their progress through a Event. This event's handler is then on a Form that has the responsability to display all the info...
5
2010
by: david | last post by:
I do not know if there is a treeView control for web form in .NET 1.1. I know there is IE Webcontrol package which has the treeview control for ..net 1.0. I have tested it in .net 1.1 before. It did not work. About the status of it now? Is there any alternative for TreeView control for web form in .net 1.1 and Visual Studio 2003? How about .net 2.0 and Visual Studio 2005? Thank tou David
0
3315
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. Provide following view properties to listview, through View menu a. Tile b. Icon
9
6132
by: auntiejack56 | last post by:
Hi, I've got a treeview, and I want to display the node text property that I have a) clicked on or b) highlighted using the up or down arrows
0
10273
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9085
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
7574
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
6811
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
5469
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...
0
5603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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 we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2944
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.