changing the value of a textBox with selection from a dropDownList

G

Guest

I have a drop downList being populated by a dataSet. My dataSet has the
folliwing fields: (id, usersName, emailAddress). My dropDownList has the
DataTextField set to usersName and the dataValueField to id. I'm trying to
poulate a text box with the emailAddress value or reference it's selection in
some other manner. Any ideas?
 
O

One Handed Man \( OHM - Terry Burns \)

Here is one way . .

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

Dim Mv As New DataView(DataSet11.Tables(0))

Mv.RowFilter = "UserID=" & ComboBox1.SelectedValue().ToString()

TextBox1.Text = Mv.Item(0)("Email").ToString()

End Sub


--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
 
G

Guest

I tried your example but it's still not populating the textBox. I modified
for my environment. Am I missing something?

Private Sub usersDropDownList_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
usersDropDownList.SelectedIndexChanged

Dim Mv As New DataView(DsUsers1.Tables(0))

Mv.RowFilter = "id=" & usersDropDownList.SelectedValue().ToString()

emailAddressBox.Text = Mv.Item(0)("EmailAddress").ToString()

End Sub
 
O

One Handed Man \( OHM - Terry Burns \)

Perhaps the valueItem for the combobox is not the ID ?

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
 
G

Guest

it's definately id. using it elsewhere in the code. Well thanks anyway, you
pointed me in the right direction. i'll tinker and post what i found.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top