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.DisplayMember = "employee"; cmbEmp.ValueMember = "employee"; cmbEmp.DataSource = empTable; string jobSql = string.Format("Select (CAST(job_id AS VARCHAR(MAX))+ ' - '+job_name) as job, job_price FROM job"); DataTable jobTable = FillTable(jobSql); cmbJob.DisplayMember = "job"; cmbJob.ValueMember = "job_price"; cmbJob.DataSource = jobTable; } private void cmbJob_SelectedIndexChanged(object sender, EventArgs e) { if (cmbJob.SelectedIndex == -1) { txtPrice.Text = string.Empty; } else { txtPrice.Text = cmbJob.SelectedValue.ToString(); } }
txtPrice.Text = cmbJob.SelectedValue.Substring(cmbJob.SelectedValue.ToString().IndexOf("_")+1);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)