Return appropriate data...

Posted on 2005-04-22
Last Modified: 2010-04-23
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"
Question by:johnqtr
    1 Comment
    LVL 13

    Accepted Solution

    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

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now