|
-
Dec 19th, 2001, 12:32 AM
#1
treeview
hello there,
how can i create treeview and use it to open form1 and form2 while running the program,
i need the codes.
i know someone done it before,
thanks
I'm on line
-
Dec 19th, 2001, 12:40 AM
#2
***???
You are going to have to be a lot more specific - I've got no idea what you are actually asking. Rephrase the question (and add a bit more detail), and I'll try to help. 
- gaffa
-
Dec 19th, 2001, 12:42 AM
#3
Fanatic Member
how can i create treeview and use it to open form1 and form2 while running the program
??????
Can not understand
-
Dec 19th, 2001, 02:00 AM
#4
ok gaffa,
i use to add commands buttons as
Private Sub cmd1_click()
form1.show
end sub
Private Sub cmd2_click()
form2.show
end sub
so instead of using these codes and buttons
i was thinking to use treeview to show either form1
or form2 when i click on the name of the form
i hope this is clear
thanks.
-
Dec 19th, 2001, 02:26 AM
#5
Addicted Member
hi ,
add treeview to ur form , and type this code :
Code:
Private Sub Form_Load()
TreeView1.Nodes.Add , , "K1", "Available Form"
TreeView1.Nodes(1).Expanded = True
For i = 1 To 10
TreeView1.Nodes.Add "K1", tvwChild, , "Form -" & i
Next
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
MsgBox Node.Text
Select Case Node.Text
Case "Form -1": 'do something here
Case "Form -2": 'do
'etc
End Select
End Sub
BTW, Is Ur Name LINA?
-
Dec 19th, 2001, 04:28 AM
#6
thanks for the reply,
i have copy ur codes but, i have error as
variable not defined
For i = 1 To 10
I'm on line
-
Dec 19th, 2001, 04:30 AM
#7
Addicted Member
add DIm i as Integer at the top
-
Dec 19th, 2001, 04:42 AM
#8
thanks that was greatfull,
Who can crack This :
Q33NY change the font to Wingdings
thanks any way
-
Dec 22nd, 2001, 12:13 AM
#9
ok E-Link,
one more thing,
when i click on the treeview for form1 it works good but,
how can i make the msgbox "opening form 1" , when i have more than one form ,form1 as (sea) , form 2 as
(sand), form3 as (sky), and so on,
pls. advice
thanks for the help
I'm on line
-
Dec 23rd, 2001, 02:09 PM
#10
ok E-Link,
second time asking,
i wonder if the msgbox can display the form name when clicking on the treeview using the codes on tops.
pls. someone help
-
Dec 23rd, 2001, 02:18 PM
#11
Frenzied Member
VB Code:
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
'I think the MsgBox would be annoying to anyone using your program
MsgBox "Opening " & Node.Text
Select Case Node.Text
Case "Form -1": Form1.Show
Case "Form -2": Form1.Show
End Select
End Sub
Greg
PS
Q33NY change the font to Wingdings
This is stupid and meaningless.
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
-
Dec 23rd, 2001, 02:41 PM
#12
fisrt thanks for your reply,
second ( Q33NY change the font to Wingdings
) that was [ E-Link ] quote: asking who can crack this, was not mine,
third i have tried your codes and i'm getting the same result
becuase i was asking if i have qnty2 forms
1:-form1 named as sky , form2 named as sand,
2:- the msgbox will display this ( opening form1), which i know ,
again i want the msgbox to display the form name , and i know the msgbox how to be used in normal ways)
i hope my request is clear,
thank u
-
Dec 23rd, 2001, 03:07 PM
#13
Frenzied Member
Instead of the loop
VB Code:
For i = 1 To 10
TreeView1.Nodes.Add "K1", tvwChild, , "Form -" & i
Next
You need to add each form to the treeview
VB Code:
TreeView1.Nodes.Add "K1", tvwChild, , "frmSky"
TreeView1.Nodes.Add "K1", tvwChild, , "frmWater"
TreeView1.Nodes.Add "K1", tvwChild, , "frmLand"
Also change the Select Case block to check for these form names instead of Form -1, Form -2, etc
Greg
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
-
Dec 24th, 2001, 02:01 AM
#14
gdebacker,
that was greatful, thanks for the help
-
Jan 2nd, 2002, 12:57 AM
#15
gdebacker,
happy new year to evey body
after set project > refrance > microsoft window common control 2 6.0 (sp3).
i used this codes but i maight done some thing wrong
i have error on codes below pls. check
Set NODX = TreeView1.Nodes.Add(, , "RP", "SUBJECT")
Private Sub Form_Load()
Dim NODX As Node
Set NODX = TreeView1.Nodes.Add(, , "RP", "SUBJECT")
Set NODX = TreeView1.Nodes.Add("RP", tvwChild, "C1", "CALCULATION")
Set NODX = TreeView1.Nodes.Add("C1", tvwChild, "C2", "FOOD")
Set NODX = TreeView1.Nodes.Add("C2", tvwChild, "C19", "FOOD DETAILL")
Set NODX = TreeView1.Nodes.Add("C1", tvwChild, "C3", "KIDS")
Set NODX = TreeView1.Nodes.Add("C3", tvwChild, "C20", "KIDS DETAILL")
Set NODX = TreeView1.Nodes.Add("C1", tvwChild, "C4", "MAIDS")
Set NODX = TreeView1.Nodes.Add("C4", tvwChild, "C21", "MAIDS DETAILL")
Set NODX = TreeView1.Nodes.Add("C1", tvwChild, "C5", "CARS")
Set NODX = TreeView1.Nodes.Add("C5", tvwChild, "C22", "CARS DETAILL")
Set NODX = TreeView1.Nodes.Add("C1", tvwChild, "C6", "OTHERS")
Set NODX = TreeView1.Nodes.Add("C6", tvwChild, "C23", "OTHERS DETAILL")
Set NODX = TreeView1.Nodes.Add("RP", tvwChild, "C7", "INFORMATIONS")
Set NODX = TreeView1.Nodes.Add("C7", tvwChild, "C8", "TELEPHONE")
Set NODX = TreeView1.Nodes.Add("C7", tvwChild, "C9", "DOCUMENTS")
Set NODX = TreeView1.Nodes.Add("C7", tvwChild, "C10", "BILLS")
Set NODX = TreeView1.Nodes.Add("C7", tvwChild, "C11", "REMARKS")
Set NODX = TreeView1.Nodes.Add("RP", tvwChild, "C12", "REPORTS")
Set NODX = TreeView1.Nodes.Add("C12", tvwChild, "C13", "GENERAL")
'Set NODX = TreeView1.Nodes.Add("C13", tvwChild, "C14", "FOOD DETAILL")
'Set NODX = TreeView1.Nodes.Add("C13", tvwChild, "C15", "KIDSD DETAILL")
'Set NODX = TreeView1.Nodes.Add("C13", tvwChild, "C16", "OTHERS DETAILL")
'Set NODX = TreeView1.Nodes.Add("C13", tvwChild, "C17", "CARS DETAILL")
'Set NODX = TreeView1.Nodes.Add("C13", tvwChild, "C18", "MAIDS DETAILL")
Set NODX = TreeView1.Nodes.Add("RP", tvwChild, "C24", "EXIT")
TreeView1.LineStyle = tvwRootLines
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
'MsgBox "Opening " & Node.Text
Select Case Node.Text
Case "EXIT": MsgBox " WANT TO EXIT", , "ECO": End
Case "OTHERS": OTHERS.Show: FOOD.Hide: KIDS.Hide: MAIDS.Hide: CARS.Hide: frmresult.Show: frmtreeview.Show 'do
Case "KIDS": KIDS.Show: FOOD.Hide: OTHERS.Hide: MAIDS.Hide: OTHERS.Hide: frmresult.Show: frmtreeview.Show 'do
Case "MAIDS": MAIDS.Show: FOOD.Hide: OTHERS.Hide: CARS.Hide: KIDS.Hide: frmresult.Show: frmtreeview.Show 'do
Case "FOOD": FOOD.Show: MAIDS.Hide: OTHERS.Hide: KIDS.Hide: CARS.Hide: frmresult.Show: frmtreeview.Show 'do
Case "CARS": CARS.Show: MAIDS.Hide: OTHERS.Hide: KIDS.Hide: FOOD.Hide: frmresult.Show: frmtreeview.Show 'do
End Select
TreeView1.LineStyle = tvwRootLines
End Sub
I'M on line
-
Jan 2nd, 2002, 01:30 AM
#16
Addicted Member
-
Jan 2nd, 2002, 02:49 AM
#17
i don't have the (sp4)
from where u got it
i have got only> window common control 2 6.0 (sp3).
on vb.6
maybe gdebacker could advice
thanks for the reply any way
-
Jan 2nd, 2002, 04:01 PM
#18
Frenzied Member
I was able to run your Form_Load() code to create the TreeView Nodes. What error do you receive? You should get an Error Number and an Error Description.
Greg
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|