DataGridView的几个基本操作

摘要: DataGridView的几个基本操作:1、获得某个(指定的)单元格的值:dataGridView1.Row[i].Cells[j].Value;2、获得选中的总行数:dataGridView1.SelectedRows.Count;3、获得当前选中行的索引:dataGridView1.CurrentRow.Index;4、获得当前选中单元格的值:dataGridView1.CurrentCell.Value;5、取选中行的数据string[] str = new string[dataGridView.Rows.Count];for(int i;i<dataGridView1.Rows 阅读全文
posted @ 2013-12-07 10:25 yeren 阅读(236) 评论(0) 推荐(0) 编辑

把datagridview中的自动排序功能禁用

摘要: 把datagridview中的自动排序功能禁用自己收集的两种方法,看看吧①DataGridView中的Columns属性里面可以设置。进入“EditColumns”窗口后,在相应的列属性设置里面把SortMode属性选择为"NotSortable"② for (int i = 0; i < this.dataGridView1.Columns.Count;i++) { this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } 阅读全文
posted @ 2013-12-07 10:24 yeren 阅读(573) 评论(0) 推荐(0) 编辑

C# 编码规范和编程好习惯[转]

摘要: 谁都会写代码!几个月的编程经验可以让你写出“可运行应用程序”。让它可运行容易,但是以最有效率的方式编码就需要下更多的功夫! 要知道,大多数程序员在写“可运行代码”,而不是“高效代码”。你想成为你们公司”最尊贵的专业人员“吗?写”高效代码“是一项艺术,你必须学习和实践它。命名惯例和规范注记 : Pascal 大小写形式-所有单词第一个字母大写,其他字母小写。 Camel 大小写形式-除了第一个单词,所有单词第一个字母大写,其他字母小写。类名使用Pascal 大小写形式 public class HelloWorld{ ...} 方法使用Pascal 大小写形式 public class Hell 阅读全文
posted @ 2013-12-05 07:05 yeren 阅读(192) 评论(0) 推荐(0) 编辑