Hi, I have a 2 text boxes tbox1 and tbox2 now i want to populate tbox2 when a value is entered in tbox1...how this can be done?

note: Supplier Table
tbox1: SuppilerID
tbox2: SupplierName..Should populate when supplierID is entered.

How this can be done. As I am using MSAccess db...

Please help out

use Textchanged event for first text box with autopostback property set to true.and in that event populate textbox2 values and assign.use update panel if u dont want to refresh the page up on postbacks.

Hi,

I have done following is this correct behavior?

    private void textBox1_TextChanged(object sender, EventArgs e)
    {

        String q = "Select SupplierName from Supplier where Supplier id=" + sender;
        textBox2.Text = textBox2.Text.ToString(q);
    }

Thanks,
Regards,

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Hi I have a combo box that shows data called from a table in my database. The Combo box shows a specific field (Product Name). I then have another text box that I need to update with the price of that product that is already saved.
This is my code that I have but I am getting errors.

private void cmbProductName_SelectedIndexChanged(object sender, EventArgs e)
        {
            
            txtPPU.Text = picnmuxDataset.Tables["Stock"].Rows["Stock"].ItemArray[3].ToString();
        }

I am getting errors on this.

cmbProductName.DataSource = picnmuxDataset.Tables["Stock"];//Table data
            cmbProductName.DisplayMember = "ProductName"; //row of data
            cmbProductName.ValueMember = "ProductID";//value to be used

This is the code for my combo box.

Any help would be greatly appreciated

form_load: comboBox2.Enabled = false;
comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
comboBox2.Enabled = true;

}

This article has been dead for over six months. Start a new discussion instead.