首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

怎么更改DataGridView列数据类型

2012-09-17 
如何更改DataGridView列数据类型如图性别一列在数据库中的数据类型是bit如何让表格显示男、女谢谢各位大哥

如何更改DataGridView列数据类型
如图
性别一列在数据库中的数据类型是bit 如何让表格显示男、女
谢谢各位大哥大姐,小弟在此谢过!~~

[解决办法]
看不见图片
你照着下面的代码写

private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
string gender = dataGridView1.CurrentRow.Cells[0].Value.ToString();
switch (gender)
{
case "1":
dataGridView1.CurrentRow.Cells[0].Value = "男";
break;
case "0":
dataGridView1.CurrentRow.Cells[0].Value = "女";
break;
default:
break;
}
}

热点排行