|
|
|
#1 (permalink) | |||||||||||
|
4.0 GHz
|
Well I have 2 listboxes right? so how do I make it so when I select a thing from the listbox1 it displays the list pertaining to the item selected it in listbox2. And if I selected a different item
from listbox1 it displays a different list in listbox2?
__________________
Future Upgrades:
Jesus is my Savior
|
|||||||||||
|
|
|
|
|
#2 (permalink) | ||||||||||||
|
110100001101001111000
|
I know nothing of VB, but in Java you generally use an array to specify the contents of a list box, or button labels or whatever. You also use events to catch certain commands and stuff.
I would make an event handler so that when an option in list1 is selected, it allows list2 to display the array of items that corresponds to the choice in list one. Not the greatest explanation, but I'm not exactly sure what VB can do. Sort of: list1 list2 option1 -> arrayOfOptions1 option2 -> arrayOfOptions2
__________________
|
||||||||||||
|
|
|
|
#3 (permalink) | ||||||||||||
|
4.0 GHz
|
Quote:
__________________
Future Upgrades:
Jesus is my Savior
|
||||||||||||
|
|
|
|
|
#4 (permalink) | |||||||||||||
|
Bifford
![]() |
Is this VB6 or VB.NET?
__________________
Helpful Posts (Hopefully )Overclocker's Calculator Photo Editing - B&W w/Color Accents
|
|||||||||||||
|
|
|
|
#5 (permalink) | |||||||||||||
|
Intel oc'er in training
|
Here's a simple version of the code I've used in the past for VB.NET. It might also work in VB6
Hope it helps. Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.FillListBox1()
Me.ListBox2.Items.Clear()
End Sub
Private Sub FillListBox1()
With Me.ListBox1
.Items.Clear()
.Items.Add("List 1")
.Items.Add("List 2")
End With
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Select Case Me.ListBox1.SelectedIndex
Case 0
With Me.ListBox2
.Items.Clear()
.Items.Add("List 1 - Item 1")
.Items.Add("List 1 - Item 2")
End With
Case 1
With Me.ListBox2
.Items.Clear()
.Items.Add("List 2 - Item 1")
.Items.Add("List 2 - Item 2")
End With
End Select
End Sub
End Class
__________________
E6600 L717A @ 3560Mhz CPUz validated --> ID 242627 ...Gaming rig being rebuilt after new mobo...![]()
|
|||||||||||||
|
|
|
|
#6 (permalink) | |||||||||||
|
4.0 GHz
|
I use visual studio 2005 I think its based off VB6? but thanks Zeus... I'll try the code out...
__________________
Future Upgrades:
Jesus is my Savior
|
|||||||||||
|
|
|
|
|
#7 (permalink) | |||||||||||||
|
Bifford
![]() |
That is VB.NET v2
__________________
Helpful Posts (Hopefully )Overclocker's Calculator Photo Editing - B&W w/Color Accents
|
|||||||||||||
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|