RomeoX 0 Unverified User

Hi everybody,

Actually I'm trying to learn C# by myself, and I was thinking to create a small program, I was thinking to build 4 buttons, First, Next, Previous, Last. I'm using Oracle express database.

I tried my best before posting here, and this is my code for next and last:

Last_button

private void last_record_Click(object sender, EventArgs e)
        {
int i=;
DataSet ds;
i = ds.Tables["emp_users"].Rows.Count - 1;
this.id.Text = ds.Tables["emp_users"].Rows[i]["id"].ToString();
this.nom.Text = ds.Tables["emp_users"].Rows[i]["nom"].ToString();
this.user.Text = ds.Tables["emp_users"].Rows[i]["usernom"].ToString();
this.pass.Text = ds.Tables["emp_users"].Rows[i]["passwod"].ToString(); }

Next_button

private void next_record_Click(object sender, EventArgs e)
        {
this.BindingContext(ds2, "emp_users").position = 0;
           this.BindingContext(ds2, "emp_users");
           da.Fill(dt);

           this.BindingContext[ds, "emp_users"].Position += 1;
}

=================================

Also I tried to create another code to read the row from database that is displaying in the form as follows but it doesn't work, I don't know why. could anyone have a look and tell me why,

private void ShowPosition()
        {
            int iCnt;
            int iPos;
            iCnt = this.BindingContext[ds, "emp_users"].Count;
            iPos = this.BindingContext[ds, "emp_users"].Position + 1;
            if (iCnt == 0)
            {
           //     this.textBox1.Text = "(No records)";
                this.label7.Text = "(No records)";
            }
            else
            {
                //this.textBox1.Text = iPos.ToString() + " of " + iCnt.ToString();
                this.label7.Text = iPos.ToString() + " of " + iCnt.ToString();
            }
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.