wpf comboBox取值问题

这是获取值后台代码

private void button1_Click(object sender, RoutedEventArgs e)
        {
            combBox = this.comboBox1.SelectedItem as ComboBoxItem;
            combBox1 = this.comboBox2.SelectedItem as ComboBoxItem;
            string type = combBox.Content.ToString();
            string type1 = combBox1.Content.ToString();
            MessageBox.Show(type+type1);
        }
        ComboBoxItem combBox;
        ComboBoxItem combBox1;
        string value = "";
        private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItem cbItem = (ComboBoxItem)(sender as ComboBox).SelectedItem;
            value = cbItem.Content.ToString();
            MessageBox.Show(value);

// string v = (sender as ComboBox).SelectedValue.ToString();
           // string bx=  v as string;
           // MessageBox.Show(bx);
       
        }

上一篇:ylb:SQLServer常用系统函数-字符串函数、配置函数、系统统计函数


下一篇:SQLServer判断指定列的默认值是否存在,并修改默认值