|
-
Aug 18th, 2009, 04:28 AM
#1
Thread Starter
New Member
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
-
Aug 18th, 2009, 05:25 AM
#2
Re: dropdownlists
Just put in the selectedindex change event of the first combo box, something like:
VB.NET Code:
If cb2.SelectedIndex = -1 Then MsgBox("You must select a country.", MsgBoxStyle.Information) Exit Sub End If
Rate People That Helped You
Mark Thread Resolved When Resolved
-
Aug 18th, 2009, 05:29 AM
#3
Thread Starter
New Member
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
-
Aug 18th, 2009, 05:32 AM
#4
Re: dropdownlists
Just select the SelectIndexChanged event of the first combo box...
VB.NET Code:
Private Sub cb1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cb1.SelectedIndexChanged If cb2.SelectedIndex = -1 Then MsgBox("You must select a country.", MsgBoxStyle.Information) Exit Sub End If 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
-
Aug 18th, 2009, 05:35 AM
#5
Thread Starter
New Member
Re: dropdownlists
ok great will try that thanks for the help
-
Aug 18th, 2009, 06:03 AM
#6
Thread Starter
New Member
Re: dropdownlists
everytime i open the forum the message box pops up
-
Aug 18th, 2009, 09:00 AM
#7
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|