急用~~!!!!!!!请问 如何将DataGridView 控件中 当前行中的指定列的值(即: this.dataGridView1.CurrentRow.Cells[6].Value(string 类型的)) 转换为 boolean 类型的

解决方案 »

  1.   

    (bool)this.dataGridView1.CurrentRow.Cells[6].Value(string 类型的)
      

  2.   

    Convert.ToBoolean();
    Or:
    bool.Parse(string str);
    不过str只能为true或false时才能转换
      

  3.   

    string a ="1";
    byte b = (byte)a.ToCharArray()[0];
    MessageBox.Show((Convert.ToBoolean(b)).ToString());
      

  4.   


    请问 如何将DataGridView 控件中 当前行中的指定列的值(即: this.dataGridView1.CurrentRow.Cells[6].Value(string 类型的)) 转换为 boolean 类型的 
    =========
    如果你的Cells[6].Value(string 类型的)是true或false,那么可以用 三元运算符号(?:)进行判断。
      

  5.   

    try
    {
    bool x=bool.Parse(this.dataGridView1.CurrentRow.Cells[6].Value)
    }
    catch
    {MessageBox.Show("字符串格式错误!");}