using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data; using System.Data.SqlClient; namespace GlassProducingManagement { public partial class Customers : Form { SqlDataAdapter sqlda1; SqlConnection connection = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Hadi\documents\visual studio 2010\Projects\GlassProducingManagement\GlassProducingManagement\GMPdata.mdf;Integrated Security=True;User Instance=True"); DataTable dtCustomers; CurrencyManager CM1; public Customers() { InitializeComponent(); sqlda1 = new SqlDataAdapter("Select * From Customers", connection); dtCustomers = new System.Data.DataTable(); sqlda1.Fill(dtCustomers); dataGridView1.DataSource = dtCustomers; CM1 = (CurrencyManager)(this.BindingContext[dtCustomers]); private void btGotoNewRow_Click(object sender, EventArgs e) { CM1.Position = CM1.Count; dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.RowCount - 1; } } }
private void btGotoNewRow_Click(object sender, EventArgs e) { CM1.AddNew(); CM1.Position = CM1.Count; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)