Sub ListView1_ItemClick (Position As Int, Value As Object)
ListView2.Clear
Select Value
Case "a"
ListView2.Add("a1")
ListView2.Add("a2")
'...
Case "b"
ListView2.Add("b1")
ListView2.Add("b2")
'...
End Select
End Sub
Sub ListView1_ItemClick (Position As Int, Value As Object)
ListView2.Clear
Select Position
Case 0
ListView2.Add("a1")
ListView2.Add("a2")
'...
Case 1
ListView2.Add("b1")
ListView2.Add("b2")
'...
End Select
End Sub
Hi Klaus,
Thanks for the help... i need one more help...
i have say 4 buttons..1,2,3,4
and have 2 listviews,
wen i click on each buttons the items in the listview1 should change..for e.g...on the click of say 1.button the items should change in list1 to a1,b1,c1...wen 2 is pressed a2,b2...
wen i click on the first list1 items at any position, it should show the related items in second list2.
for e.g.
listview1 items on button click 1-
a1
b1
c1
d1
e1
wen i click on say "a1" it should show list2 items as a11,a12,a13,...
if i click on "d" then in list2 items should change to d11,d12,d13...
Please let me know if i should put code under button click or listview..
@rbsoft
Interesting to know. I remember the difference already from Basic4PPC and changed my mind at that time. If I once would need to code in VB I surely would make the inverse mistake.
@ginsh
You need to put the code to fill ListView1 in the Button_Click event routines and put the code to fill ListView2 in the ListView1_ItemClick event routine.
You could set the Click event for all buttons to one routine and use the Tag property to know what button raised the event.
Depending on how the values are defined it could be interesting to use a three dimension array to save the values.
Values(i, j, k)
Dimesion i for a12, b23 etc.
Dimesion j for a12, b23 etc.
Dimesion k for a12, b23 etc.
In that way you could easily use the indexes to fill the ListViews.
Best regards.
Sub Globals
Dim Data as sting
End sub
Sub ListView2_ItemClick (Position As Int, value As Object)
ListView1.Clear
If Data = "A" Then
Select Position
Case 0
ListView1.AddSingleLine("a1")
ListView1.AddSingleLine("a2")
Case 1
ListView1.AddSingleLine("a3")
ListView1.AddSingleLine("a4")
End Select
End If
If Data = "B" Then
Select Position
Case 0
ListView1.AddSingleLine("D1")
ListView1.AddSingleLine("D2")
Case 1
ListView1.AddSingleLine("D3")
ListView1.AddSingleLine("D4")
End Select
End If