Results 1 to 8 of 8

Thread: [RESOLVED] comboBox

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    25

    Resolved [RESOLVED] comboBox

    hi does anyone know how to read an array from a dialog box?
    i want to read the code below.. need help urgently pls... thnx...
    Code:
     Private Shared ReadOnly route As String() = { _
            "Holland Circle", "Darbin", "Bugis", "Coronation Street", "Winnard", _
            "Bridgetown", "Gorky", "Interimo", "Bishan", "Woodland Rise" _
        }

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: comboBox

    I have no idea what you are asking. You want to display the contents of that array in a dialog?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    25

    Re: comboBox

    ooh.. sorry, i want that data in the array to appear in a dropdown list when i run the code..
    so am asking for a way to do that
    tnx..

  4. #4
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: comboBox

    Something along thesse lines:
    Code:
    Public Class Form1
    
        Private Shared ReadOnly route As String() = { _
               "Holland Circle", "Darbin", "Bugis", "Coronation Street", "Winnard", _
               "Bridgetown", "Gorky", "Interimo", "Bishan", "Woodland Rise"}
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            Me.ComboBox1.DataSource = route
    
        End Sub
    
    End Class

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    25

    Re: comboBox

    this is what i have an its not working.. can u pls tell me what am doing wrong.
    Code:
        Private Shared ReadOnly route As String() = { _
            "Holland Circle", "Darbin", "Bugis", "Coronation Street", "Winnard", _
            "Bridgetown", "Gorky", "Interimo", "Bishan", "Woodland Rise" _
        }
        
        Private Sub oringinComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles oringinComboBox.SelectedIndexChanged
            me.oringinComboBox.DataSource = route
        End Sub
        Private Sub destnComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles destnComboBox.SelectedIndexChanged
            me.destnComboBox.DataSource = route
        End Sub

  6. #6
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: comboBox

    Read your code.... You are reloading the combobox(s) every time you make a selection.

    Re read my post - The Combo loads at Form_Load() - for example.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    25

    Re: comboBox

    tnx alot... i can now load it... but i have 2 comboBoxes that get there data from the array,
    and they move together. i mean when i select an item in the first combo box, the other comboxbox automatically selects the same item i selected in the first comboBox, why is this? and how can i get it to select individually?
    thank you so much, at list theres some light nw.. i've been struggling for it to show something a while now...
    Code:
     Private Shared ReadOnly route As String() = { _
            "Holland Circle", "Darbin", "Bugis", "Coronation Street", "Winnard", _
            "Bridgetown", "Gorky", "Interimo", "Bishan", "Woodland Rise" _
        }
        
        Private Sub frmArea1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.oringinComboBox.DataSource = route
            Me.destnComboBox.DataSource = route
        End Sub

  8. #8
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [RESOLVED] comboBox

    Because when you assign the same array to 2 datasources they are bound together.

    Change your formload code to have this, which will simply just load each combo with the string contents of your array.

    Code:
            Me.oringinComboBox.Items.AddRange(route)
            Me.destnComboBox.Items.AddRange(route)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width