private void frmEmployeesJobs_Load(object sender, EventArgs e) { string empSql = string.Format("Select (CAST(employee_id AS VARCHAR(MAX))+ ' - '+employee_name) as employee FROM employee"); DataTable empTable = FillTable(empSql); cmbEmp.DataSource = empTable; cmbEmp.DisplayMember = "employee"; string jobSql = string.Format("Select (CAST(job_id AS VARCHAR(MAX))+ ' - '+job_name) as job, job_price FROM job"); DataTable jobTable = FillTable(jobSql); cmbJob.DataSource = jobTable; cmbJob.DisplayMember = "job"; }
private void cmbJob_SelectedIndexChanged(object sender, EventArgs e) { if (cmbJob.SelectedIndex == -1) { txtPrice.Text = string.Empty; } else { txtPrice.Text = cmbJob.SelectedItem.ToString(); } basically what i want to do is fill the price textbox when ever a job is selected }
txtPrice.Text = cmbJob.SelectedText.ToString(); //if selected Text to be displayed txtPrice.Text = cmbJob.SelectedValue.ToString(); // if selected value to be displayed
txtPrice.Text = cmbJob.SelectedValue.ToString();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)