473,698 Members | 2,409 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing the value of a textBox with selection from a dropDownList

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?
Nov 21 '05 #1
4 1384
Here is one way . .

Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged

Dim Mv As New DataView(DataSe t11.Tables(0))

Mv.RowFilter = "UserID=" & ComboBox1.Selec tedValue().ToSt ring()

TextBox1.Text = Mv.Item(0)("Ema il").ToString ()

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

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
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))
--
"rr****@800mcma han.com" <rr************ *****@discussio ns.microsoft.co m>
wrote in message news:76******** *************** ***********@mic rosoft.com...
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?

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

Private Sub usersDropDownLi st_SelectedInde xChanged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
usersDropDownLi st.SelectedInde xChanged

Dim Mv As New DataView(DsUser s1.Tables(0))

Mv.RowFilter = "id=" & usersDropDownLi st.SelectedValu e().ToString()

emailAddressBox .Text = Mv.Item(0)("Ema ilAddress").ToS tring()

End Sub


"One Handed Man ( OHM - Terry Burns )" wrote:
Here is one way . .

Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged

Dim Mv As New DataView(DataSe t11.Tables(0))

Mv.RowFilter = "UserID=" & ComboBox1.Selec tedValue().ToSt ring()

TextBox1.Text = Mv.Item(0)("Ema il").ToString ()

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

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
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))
--
"rr****@800mcma han.com" <rr************ *****@discussio ns.microsoft.co m>
wrote in message news:76******** *************** ***********@mic rosoft.com...
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?


Nov 21 '05 #3
Perhaps the valueItem for the combobox is not the ID ?

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

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
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))
--
"rr****@800mcma han.com" <rr************ *****@discussio ns.microsoft.co m>
wrote in message news:05******** *************** ***********@mic rosoft.com...
I tried your example but it's still not populating the textBox. I modified
for my environment. Am I missing something?

Private Sub usersDropDownLi st_SelectedInde xChanged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
usersDropDownLi st.SelectedInde xChanged

Dim Mv As New DataView(DsUser s1.Tables(0))

Mv.RowFilter = "id=" & usersDropDownLi st.SelectedValu e().ToString()

emailAddressBox .Text = Mv.Item(0)("Ema ilAddress").ToS tring()

End Sub


"One Handed Man ( OHM - Terry Burns )" wrote:
Here is one way . .

Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged

Dim Mv As New DataView(DataSe t11.Tables(0))

Mv.RowFilter = "UserID=" & ComboBox1.Selec tedValue().ToSt ring()

TextBox1.Text = Mv.Item(0)("Ema il").ToString ()

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

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
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))
--
"rr****@800mcma han.com" <rr************ *****@discussio ns.microsoft.co m>
wrote in message
news:76******** *************** ***********@mic rosoft.com...
>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?


Nov 21 '05 #4
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.

"One Handed Man ( OHM - Terry Burns )" wrote:
Perhaps the valueItem for the combobox is not the ID ?

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

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
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))
--
"rr****@800mcma han.com" <rr************ *****@discussio ns.microsoft.co m>
wrote in message news:05******** *************** ***********@mic rosoft.com...
I tried your example but it's still not populating the textBox. I modified
for my environment. Am I missing something?

Private Sub usersDropDownLi st_SelectedInde xChanged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
usersDropDownLi st.SelectedInde xChanged

Dim Mv As New DataView(DsUser s1.Tables(0))

Mv.RowFilter = "id=" & usersDropDownLi st.SelectedValu e().ToString()

emailAddressBox .Text = Mv.Item(0)("Ema ilAddress").ToS tring()

End Sub


"One Handed Man ( OHM - Terry Burns )" wrote:
Here is one way . .

Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged

Dim Mv As New DataView(DataSe t11.Tables(0))

Mv.RowFilter = "UserID=" & ComboBox1.Selec tedValue().ToSt ring()

TextBox1.Text = Mv.Item(0)("Ema il").ToString ()

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

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
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))
--
"rr****@800mcma han.com" <rr************ *****@discussio ns.microsoft.co m>
wrote in message
news:76******** *************** ***********@mic rosoft.com...
>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?


Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2972
by: NewToDotNet | last post by:
Hi, I am very new to ASP.NET and web programming in general. I have one issue. I have a Datagrid object with Edit template. In one Datagrid row, I have 1 DropdownList, 1 textbox and 1 readonly textbox in Edit mode. I have written OnTextChanged event handler for text box and OnSelectionIndexChanged event handler for dropdownlist. Whenever a text is changed in writable textbox or a selection is changed in DropDownList, I perform calculations...
2
2017
by: jason | last post by:
Pardon my ignorance on this. The below code works, except, when I edit a record and update the two drop downs take the first entry in the dropdownlist if not selected. I'd also like the dropdown to show the current value in edit mode. I'm sure this is a common question. I've reviewed several related post and tried them out to no avial. Some of the offerings in listgroup look right on, but are not clear on where to handle the suggested...
0
1532
by: Luis Esteban Valencia | last post by:
Hello. I have a datagrid with one row. I have a button that adds a new row. I am trying to implement that when the user selects one product it must change the price on the quantity column. Anyway when the user selects the first dropdownlist the dropdownselected_indexchanged is firring but when the user chagnes the second dropdownlist its not firing. aahh! if the user selects any of both dropdownlist the datagrid stays with only one row?...
4
1317
by: Christina | last post by:
Hello everyone, Am having trouble solving a problem of DropDownList. I have 2 dropdownlists say 'ddlA' and 'ddlB', and a text box. Based on the selection in ddlA, I have to display some data in the textbox. And on selection in ddlB, the data has to change in the same textbox. The problem is:
4
15995
by: Chris Kettenbach | last post by:
Good morning all, I am sure this has been asked but I did not see anything. I have a datalist control. In the edititemtemplate I have a dropdownlist. I know on the itemdatabound event is where I can set the dropdownlist selectedindex. How do I set the correct value? private void lstDegrees_ItemDataBound(object sender, DataListItemEventArgs e) {
2
4550
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was set to...it is set to false. Can someone show me what I am doing wrong and tell me the correct way? Thank you. In the page load event, I am doing the following:
3
2817
by: vivela | last post by:
hi, I hope you could help me out on this one,cause I have been trying for 4 days to solve it,but couldn't quite get it right: I have an ASP textbox that should change the value in a dropdownlist. this happens,but the problem is with the validation of the ddl.it has a requiredfieldvalidator,and the error message disapears only if i select a value from the dropdownlist,even though it should also disapear when I write a valid name in the...
6
4272
by: Ahmedhussain | last post by:
Hi there, I m doing work on a gridview and Im getting an error: A potentially dangerous Request.Form value was detected from the client (ctl00$Content$GridView1$ctl03$TextBox1="<span class='txtColo...") Im using an access database. and when ever I try to update this it doesnt work. <%@ Page Language="C#" MasterPageFile="Mysite.master" Title="Untitled Page" %> <script runat = "server"> protected void Page_Load(object sender,...
5
26630
by: nzkks | last post by:
Hi I am using these: ASP.Net 2.0, VB.Net, Visual Studio 2005, SQL Server 2005, Formview controls In a ASP.Net form I have 20 textboxes and 20 dropdownlists(ddl). All ddl(s) are databound and get the data from a single objectdatasource. All textboxes and ddl(s) support null values. Textboxes are for entering numbers and ddl(s) are for selecting the unit (mm, cm, in, m3, oz, qt like these.). I am using the below code to achieve two...
0
8678
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9166
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2333
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.