急用~~!!!!!!!请问 如何将DataGridView 控件中 当前行中的指定列的值(即: this.dataGridView1.CurrentRow.Cells[6].Value(string 类型的)) 转换为 boolean 类型的
解决方案 »
- 未将对象引用设置到对象的实例--连接数据库时出现异常的解决办法
- NHibernate的作用是什么
- 怎么侧地删除自定义控件
- 水晶报表如何取某一个字段得值?
- dataGridView里指定excel的某一行当表头
- 菜鸟弱弱的问:System.NullReferenceException: 未将对象引用设置到对象的实例
- 请教:如何更新shdocvw.dll文件
- 请教WebForm下数据导出到EXCEL时无法弹出(有进程无界面)的问题
- 关于数据库中日期时间型字段的操作问题
- C# 导入EXCEL 到系统 数据转换问题
- C#的Datagrid中的cell,如何只允许输入数字
- 安装完Visual studio 2005后,无法再安装Visual Studio 2003,请求帮助!
Or:
bool.Parse(string str);
不过str只能为true或false时才能转换
byte b = (byte)a.ToCharArray()[0];
MessageBox.Show((Convert.ToBoolean(b)).ToString());
请问 如何将DataGridView 控件中 当前行中的指定列的值(即: this.dataGridView1.CurrentRow.Cells[6].Value(string 类型的)) 转换为 boolean 类型的
=========
如果你的Cells[6].Value(string 类型的)是true或false,那么可以用 三元运算符号(?:)进行判断。
{
bool x=bool.Parse(this.dataGridView1.CurrentRow.Cells[6].Value)
}
catch
{MessageBox.Show("字符串格式错误!");}