|
 |
pro_vb_dotnet thread: Treeview help
Message #1 by "Gabriel Brienza" <vbnetuk@y...> on Thu, 14 Feb 2002 17:30:34
|
|
Thank you very much for your reply.
I know I am not doing it right!!! I need to see how is
done.I am trying it to implement it in vb6 way which
is wrong and I want to do it the vb.net way but I dont
know how.
Could you spare a couple of minutes and may be use my
example and correct it so that I can see how is done
and understand it rather than saying yes yes yes.
THANKS
MY CODE:
Should I declare this inside the LoadCountry
SubRoutine?
'//declare the nodes
Private GlobeNode As TreeNode = New TreeNode()
Private CountryNode As TreeNode = New TreeNode()
Private CityNode As TreeNode = New TreeNode()
Private DummyNode As TreeNode = New TreeNode()
'/// load country +dummy city node
Private Sub LoadCountry()'//when form loads
Dim GlobeNode As TreeNode = New TreeNode("Globe")
Dim CountryNode As TreeNode
Dim DummyCityNode as treenode
Dim CountryReader As SqlDataReader
Dim conn As SqlConnection = _
New SqlConnectionconnectionString)
conn.Open()
Try
CountryReader = SqlHelper.ExecuteReader
_(conn,"Country_Read_all")
With tvwContracts.Nodes
.Clear()
GlobeNode = tvwContracts.Nodes.Add(0)
GlobeNode.Text = ("Globe")
GlobeNode.Tag = "x_"
Do While CountryReader.Read()
'//load countryName
CountryNode
NewTreenode(CountryReader.Item("CountryName"))
'//add countryName to GlobeNode(RootNode)
GlobeNode.Nodes.Add(CountryNode)
'//add a tag so that I can identify the node
CountryNode.Tag = _
'//mcCountrykey="c_"
mcCountryKey & CountryReader.Item("CountryID")
'//add a dummyCityNode to the CountryNode so that I
can
'//have a + sign and then process this in the
BeforeExpand event
DummycityNode=New TreeNode("DummyCity")
countryNode.nodes.add(DummyCityNode)
Loop
End With
End Sub
I KNOW IT'S WRONG BUT CAN YOU HELP SO THAT I
UNDERSTAND WHAT YOU DO.
I AM LOST!!!
thanks
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
|
|
 |