void repositoryItemTextEdit2_Leave(object sender, System.EventArgs e)
{
DataTable table1 = new DataTable();
System.Data.SqlClient.SqlConnection sqlcon = new System.Data.SqlClient.SqlConnection();
sqlcon.ConnectionString = "Data Source=192.168.1.1;Initial Catalog=Northwind;Persist Security Info=True;User ID=sa;Password=22";
string ss = gridView1.GetRowCellDisplayText(gridView1.FocusedRowHandle, gridView1.Columns[0]);
string selectCommand = "select * from Orders where OrderID in (" + ss + ")";
System.Data.SqlClient.SqlDataAdapter dataAdapter = new System.Data.SqlClient.SqlDataAdapter(selectCommand, sqlcon);
sqlcon.Open();
dataAdapter.Fill(table1);
sqlcon.Close();
gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[1], table1.Rows[0]["ShipAddress"].ToString());
gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[2], table1.Rows[0]["ShipCity"].ToString());
}
private void repositoryItemTextEdit3_Leave(object sender, System.EventArgs e)
{
//throw new System.NotImplementedException();
gridView1.FocusedRowHandle += 1;
gridView1.FocusedColumn = gridView1.VisibleColumns[0];
gridView1.ShowEditor();
}
private void repositoryItemTextEdit3_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
//throw new System.NotImplementedException();
if (e.KeyCode == Keys.Enter)
{
if (dataSet1.Tables["Orders"].Rows.Count == gridView1.FocusedRowHandle + 1)
{
DataRow dr = dataSet1.Tables["Orders"].NewRow();
dataSet1.Tables["Orders"].Rows.Add(dr);
}
}
}