1

Konu: C# navigation buton kodları

C# ta asagidaki buton kodu ile ilk kayda gidebildim ancak son,sonraki,onceki icin olanları yapamadim bilen varmidir ?

C#
private void cmdFirst_Click(object sender, EventArgs e)

        {
 
            CeConn = new SqlCeConnection(@"data source = " + strDataPath);
            CeCmd = new SqlCeCommand("select * from CariH", CeConn);
 
            CeAdapter = new SqlCeDataAdapter(CeCmd);
 
            DataSet DS = new DataSet();
            DS.Clear();
            CeConn.Open();
            CeAdapter.Fill(DS);
            CeConn.Close();
            CeConn.Dispose();
 
            GrdCarih.DataSource = DS.Tables[0];
            DataRow dr = DS.Tables[0].Rows[0];
        }
 
private void cmdLast_Click(object sender, EventArgs e)
        {
//?
        }
private void cmdNext_Click(object sender, EventArgs e)
        {
//?
        }
private void cmdPrior_Click(object sender, EventArgs e)
        {
//?
        }

2

Re: C# navigation buton kodları

C#
var rows = DS.Tables[0].AsEnumerable();

                DataRow firstRow = rows.First ();
                DataRow lastRow = rows.Last ();
 
              DataRow current = rows.ElementAt( 4 );
              DataRow next = rows.ElementAt( 5 );
              DataRow previous = rows.ElementAt( 3 );
 
              foreach (var row in rows)
              {
                    //...
              }

BindingSource filan yok mu. Onun current'ina baksan.

3

Re: C# navigation buton kodları

VB den bildigim MoveFirst,MoveLast,Movenext,MovePrevious DataBindingSource propertylerinde var

C#
this.carihBindingSource.MoveLast();

ilkinde calisiyor daha sonra calismiyor