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

哪位高手能帮小弟我解释下这段代码

2012-01-06 
谁能帮我解释下这段代码?publicstringdatag_zt(inta){stringbthis.dataGrid7[this.dataGrid7.CurrentRowI

谁能帮我解释下这段代码?
public   string   datag_zt(int   a)
{
string   b=this.dataGrid7[this.dataGrid7.CurrentRowIndex,a].ToString();
return   b;
}
public   int   index_d()
{
        int   bb=this.dataGrid7.CurrentRowIndex;
return   bb;
}
public   string   datag_pre(int   a)
{
string   b;
if(this.dataGrid7.CurrentRowIndex> 0)
{
this.dataGrid7.UnSelect(this.dataGrid7.CurrentRowIndex);
this.dataGrid7.CurrentRowIndex=this.dataGrid7.CurrentRowIndex-1;
b=this.dataGrid7[this.dataGrid7.CurrentRowIndex,a].ToString();

}
else
{
    b=this.dataGrid7[this.dataGrid7.CurrentRowIndex,a].ToString();
    MessageBox.Show( "上一条记录不存在! ", "提示 ",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
return   b;
}
public   string   datag_next(int   a)
{
string   b;
        int   bb=frmMain.frmbd.aa-1;

if(this.dataGrid7.CurrentRowIndex <bb)
{
this.dataGrid7.UnSelect(this.dataGrid7.CurrentRowIndex);
this.dataGrid7.CurrentRowIndex=this.dataGrid7.CurrentRowIndex+1;
b=this.dataGrid7[this.dataGrid7.CurrentRowIndex,a].ToString();
}
else
{
b=this.dataGrid7[this.dataGrid7.CurrentRowIndex,a].ToString();
MessageBox.Show( "这是最后一条记录! ", "提示 ",MessageBoxButtons.OK,MessageBoxIcon.Information);  
}
return   b;
}



[解决办法]
//dataGrid7中this.dataGrid7.CurrentRowIndex行,a列的值。
//dataGrid7選中的行的索引.
//dataGrid7如果選中的不是第一行則選擇上一行!
//dataGrid7如果選中的不是最後一行則選擇下一行!

[解决办法]
//取当前行指定索引列的值
public string datag_zt(int a)
{
string b=this.dataGrid7[this.dataGrid7.CurrentRowIndex,a].ToString();
return b;
}
[解决办法]
//当前行的索引值
public int index_d()
{
int bb=this.dataGrid7.CurrentRowIndex;
return bb;
}

热点排行