[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Return appropriate data...

I have two columns in one table on a SQL server and I'm programming using VB.NET.  The Table name is "Lots".  The two column names are "Batch" and "LotNumber".  The SqlDataAdapter is already filled with both columns.

Batch             LotNumber

batch1           LotNumber1
batch2           LotNumber2
batch3           LotNumber3
batch4           LotNumber4
batch5           LotNumber5

I have a DropDownList that shows all of the LotNumbers.  When the user selects a LotNumber I want the appropriate Batch ID to be displayed in a text box.  The LotNumbers and Batch ID's are in no way the same or have any related characters.  In other words, when the user selects the LotNumber the Batch ID for that row the LotNumber is located is returned to a textbox.  

My DropDownList box is called = "lotNumber"
My TextBox is called = "batchid"
1 Solution
Corey ScheichDeveloperCommented:
lotNumber.ValueMember = "Batch"
lotNumber.DisplayMember = "LotNumber"

lotNumber.dataSource = AppropriateSQL_Table

TextBox.Text = lotNumber.SelectedValue

You will have to catch the SelectedValueChanged event to keep the textbox up to date.

also check this out I think it applies



Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now