大家看下我的第五行没记录
groupbox1.text显示5of 5,咋整的啊
代码: private SqlDataAdapter da;
private DataSet dsScore;
int cur;
private void Frm5_6_Load(object sender, EventArgs e)
{
con.conDataBase();
string sql = "select * from score";
SqlCommand sqlCommand = new SqlCommand(sql ,con.coon );
da = new SqlDataAdapter(sql, con.coon);
// dt = new DataTable();
dsScore=new DataSet() ;
// dt = new DataTable();
// da.Fill(dt);
da.Fill(dsScore,"score");
SqlCommandBuilder builder = new SqlCommandBuilder(da);
this.BindingContext[dsScore, "score"].PositionChanged += new EventHandler(BingingManagerBase_PositionChanged );
textBox1.DataBindings.Add(new Binding("Text", dsScore, "score.studID"));
// dataGridView1.DataSource = dt;
dataGridView1.DataSource = dsScore;
dataGridView1.DataMember = "score";
}
private void ShowPosition()
{
int iCnt, iPos;
iCnt = this.BindingContext[dsScore, "score"].Count;
iPos = this.BindingContext[dsScore, "score"].Position + 1;
if (iCnt == 0)
{
groupBox1.Text = "jgj";
}
else
{
groupBox1.Text = iPos.ToString() + "of" + iCnt.ToString();
}
}
private void BingingManagerBase_PositionChanged(object sender, EventArgs e)
{
ShowPosition();
}
大哥们给说下谢谢啊
同意楼上