DataTable table = new DataTable(); table.Columns.Add("operator", typeof(string)); table.Columns.Add("name", typeof(string)); // Here we add five DataRows. table.Rows.Add("+", "Sum"); table.Rows.Add("-", "Subtract"); table.Rows.Add("/", "Divide"); table.Rows.Add("*", "Multiply"); cmbOperator.DataSource=table; cmbOperator.DisplayMember="name"; cmbOperator.ValueMember="operator"; txtDisplay.Text = cmbOperator.SelectedValue.ToString();
Comments 0