New Message on dotNET User Group Hyd

combobox help?

Reply
  Reply to Sender   Recommend Message 2 in Discussion
From: vamsum_kris

tis simple
use array of arrays (or 2d arrays) see the attached file. see the code below 2 get an idea-
 
'WE CAN DO THIS IN A NUMBER OF WAYS
' BUT I THINK THIS IS A BEST(BUT NOT THE EASIEST) WAY

' TO REFLECT THE CHANGE OF COMBOBOX IN ANOTHER LIST BOX(OR COMBO)
'FIRST CREATE AN ARRAY OF ARRAYS(OPTION STRICT OFF) AND KEEP DUMPING ALL THE ELEMENTS
' OF THE ARRAY TO THE LIST BOX OF THE SELECTTED INDEX (IN COMBO BOX)

Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim ar(2) As Object 'DECLARE ARRAY OF ARRYS

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        ListBox1.Items.Clear()
        Dim i As String
        For Each i In ar(ComboBox1.SelectedIndex)
            ListBox1.Items.Add(i)
        Next
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'FIRST INITIALIZE THE LIST
        Dim cities1() As String = {"Hyderabad", "Nellore", "Vijayawada", "Secunderabad"}
        Dim cities2() As String = {"Chennai", "Coimbatore"}
        Dim cities3() As String = {"Jammu", "Srinagar"}
        ar(0) = cities1
        ar(1) = cities2
        ar(2) = cities3
        'U CAN ALSO TRY 2DARRAYS BUT ALL THE ARRAY ELEMTS IN EACH ARRAY HAVE TO BE SAME IN
        'NUMBER SO I THINK THIS METHID IS BEST AS THIS HAS NO SUCH RESTRICTIONS
    End Sub
End Class
'IF U GOT A DOUBT (OR A JOB) ;) EMAIL ME @ [EMAIL PROTECTED]
 

View other groups in this category.

Click here
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to