如何使用导航键显示表单记录 [英] How to show records of form by using navigation key

查看:73
本文介绍了如何使用导航键显示表单记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在数据库中有10条记录,并且有一个带有带有文本框的gridview的表单.我必须从数据库中检索数据并填充上面的控件.并且必须使用导航键在所有控件中显示数据.

所以该怎么做,请有人帮我.

Suppose i have 10 records in database and a form having a gridview with text boxes. I have to retrieve data from database and populate the above control. And by using navigation key have to show data in all that control.

so how to do this,please somebody help me.

推荐答案

您的意思是类似MS Access的记录视图吗?

您可以使用数据集来绑定字段
Do you mean something like MS Access''s record view?

You Could use a dataset to bind fields


首先必须编写一个方法[ShowData()],通过该方法我们可以显示在给定控件中填充的整个数据...在页面加载之前声明一个变量(BILLNo).然后在每个按钮中单击即可写入,

私有void btnFirst_Click(对象发送者,EventArgs e)
{
如果(BILLNo == 1)
{
MessageBox.Show(已经在首页...!");
}
其他
{
BILLNo = 1;
ShowData();
}


}


私有无效btnPrev_Click(对象发送者,EventArgs e)
{
如果(BILLNo == 1)
{
MessageBox.Show(已在第一页..!");
}
其他
{

BILLNo--;
ShowData();

}
}

私有无效btnNext_Click(对象发送者,EventArgs e)
{

如果(BILLNo == bill)
{
MessageBox.Show(已在最后一页.!");
}
其他
{

BILLNo ++;
ShowData();
}

}

私有void btnLast_Click(对象发送者,EventArgs e)
{

如果(BILLNo == bill)
{
MessageBox.Show(已在最后一页.!");
}
其他
{

BILLNo = bill;
ShowData();
}
}
First have to write a method[ShowData()] through which we can show the entire data which are populating in the given controls...and have to declare a variable(BILLNo) before pageload.Then in every button click just write,

private void btnFirst_Click(object sender, EventArgs e)
{
if (BILLNo == 1)
{
MessageBox.Show("Already at First Page...!");
}
else
{
BILLNo = 1;
ShowData();
}


}


private void btnPrev_Click(object sender, EventArgs e)
{
if (BILLNo == 1)
{
MessageBox.Show("Already at First Page..!");
}
else
{

BILLNo--;
ShowData();

}
}

private void btnNext_Click(object sender, EventArgs e)
{

if (BILLNo==bill)
{
MessageBox.Show("Already at Last Page..!");
}
else
{

BILLNo++;
ShowData();
}

}

private void btnLast_Click(object sender, EventArgs e)
{

if (BILLNo==bill)
{
MessageBox.Show("Already at Last Page..!");
}
else
{

BILLNo =bill;
ShowData();
}
}


这篇关于如何使用导航键显示表单记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆