请大侠帮忙给二段简单的c#代码,谢谢了!我的一套简单的c#桌面程序上有四个按钮用来控制datagrid上文字行的选中,分别是“上一条记录” “下一条记录” “第一条记录” “最后一条记录”,我的“上一条记录” “下一条记录” 的代码如下;可我依壶画瓢写“第一条记录” 和“最后一条记录”按钮的代码总是报错啊!大侠能不能帮忙把这二段代码给我贴出来,我来试一下!谢谢!“上一条记录”按钮的代码private void button2_Click(object sender, System.EventArgs e)
{
if (this.mybind.Position>0)
this.mybind.Position-=1;
else
MessageBox.Show("当前记录已经是第一条");
}“下一条记录”按钮的代码 private void BtNext_Click(object sender, System.EventArgs e)
{
if (this.mybind.Position<this.mybind.Count-1)
this.mybind.Position+=1;
else
MessageBox.Show("当前记录已经是最后一条");
}
{
if (this.mybind.Position>0)
this.mybind.Position-=1;
else
MessageBox.Show("当前记录已经是第一条");
}“下一条记录”按钮的代码 private void BtNext_Click(object sender, System.EventArgs e)
{
if (this.mybind.Position<this.mybind.Count-1)
this.mybind.Position+=1;
else
MessageBox.Show("当前记录已经是最后一条");
}
解决方案 »
- C#如何创建多参数线程
- 关于datagridview中的checkbox 的bool值
- 跪求 asp dim型 转money型的方法
- listbox删除对象,调用invoke出现异常NullReferenceException
- 100分求助,关于Form焦点的问题!
- 菜鸟关于三层结构概念不清晰.自己写了个小程序.不知道是否属于三层结构请大虾帮忙看看.
- 郁闷呀 谁能帮帮我
- ******** 从 c# 怎样向 Sql Server 中写入 Binary 值?*********
- 如何不使用C#的API將bmp轉成jpg??
- 关于Windows Form的界面优化?
- 未处理的“System.NullReferenceException”类型的异常出现在 未知模块
- 我想问一下哪里有可以培训C#,然后工作后付学费的?
this.mybind.Position=this.mybind.Count-1; //最后一条记录
private void btFirst_Click(object sender, System.EventArgs e)
{
if((currManager!=null)&(currManager.Count>0))
{
//set the position at the first record 0
currManager.Position=0;
}
}