Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 149,934 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,549 people online right now. Registration is fast and FREE... Join Now!




drop down lists

 
Reply to this topicStart new topic

drop down lists

Tarfa
18 Apr, 2008 - 05:48 AM
Post #1

New D.I.C Head
*

Joined: 10 Mar, 2008
Posts: 3



Thanked: 1 times
My Contributions

Hi everyone
I want to create two dynamic drop down lists where the values that will apear in the second "D2" depend on the value selected from the first drop down list "D1"
this is the code I used but it didn't work sad.gif
please help me
CODE

Dim reader As SqlDataReader
        Dim c As SqlCommand = New SqlCommand("SELECT Teach.courseNo  FROM Teach,Users WHERE Teach.ID = Users.ID AND Users.Name LIKE '" & D1.SelectedItem.Text & "'", con)
        reader = c.ExecuteReader()
        D2.DataSource = reader
        D2.DataTextField = "Teach.courseNo"
        D2.DataBind()
        reader.Close()


thank you
User is offlineProfile CardPM
+Quote Post

nofear217
RE: Drop Down Lists
18 Apr, 2008 - 06:23 AM
Post #2

D.I.C Regular
Group Icon

Joined: 8 Nov, 2007
Posts: 253



Thanked: 6 times
Dream Kudos: 175
My Contributions
Populate your first dropdownlist (or combo box) and then do a
CODE
d2.items.add(d1.selecteditem)
something like that if that is what you are talking about. This is of course assuming your wanting the values to be preset within D1 and then transfer them to D2.

This post has been edited by nofear217: 18 Apr, 2008 - 06:23 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 03:52PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month