Results 1 to 7 of 7

Thread: dropdownlists

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2009
    Posts
    11

    dropdownlists

    hi
    i have fourm with a drop down box which has 4 things in it. e.g property, unlisted, listed

    and i have another drop down called country with a list of countries.

    what im trying to do it when someone click on the unlisted from the first drop down and tries pressing ok i want a pop up to say have to fill in country.

    anyone any ideas on how to do this

  2. #2
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: dropdownlists

    Just put in the selectedindex change event of the first combo box, something like:

    VB.NET Code:
    1. If cb2.SelectedIndex = -1 Then
    2.             MsgBox("You must select a country.", MsgBoxStyle.Information)
    3.             Exit Sub
    4.         End If

    Rate People That Helped You
    Mark Thread Resolved When Resolved

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2009
    Posts
    11

    Re: dropdownlists

    sorry i dont get what u mean by Just put in the selectedindex change event of the first combo box.

    how does the code no that i picked unlisted and not one of the other ones in the list

  4. #4
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: dropdownlists

    Just select the SelectIndexChanged event of the first combo box...

    VB.NET Code:
    1. Private Sub cb1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cb1.SelectedIndexChanged
    2.       If cb2.SelectedIndex = -1 Then
    3.                   MsgBox("You must select a country.", MsgBoxStyle.Information)
    4.                   Exit Sub
    5.               End If
    6.     End Sub

    I'm assuming that your combos are called cb1 and cb2, so you probably need to change the names...

    Rate People That Helped You
    Mark Thread Resolved When Resolved

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2009
    Posts
    11

    Re: dropdownlists

    ok great will try that thanks for the help

  6. #6

    Thread Starter
    New Member
    Join Date
    Apr 2009
    Posts
    11

    Re: dropdownlists

    everytime i open the forum the message box pops up

  7. #7
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: dropdownlists

    You need to change test value... Don't use -1 becuase -1 indicates nothing is selected by the user. Change -1 to whatever index that "Unlisted" is on in your list. Remember, index in a collection is zero based, so if Unlisted is the 2nd item in the list, its index is 1.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

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