我正在尝试使用下面的代码将值从DataGridView传递到textEdit1,但它不起作用,请帮助我。我使用SQL查询填充DataGridView,但我无法将行值传递到TextEdit。
编码
private void DataGridView_DoubleTap(object sender, DataGridGestureEventArgs e)
{
int[] selectedRowHandles = DataGridViewEmployee.GetSelectedRows();
TextEdit1.Text = System.Convert.ToString(DataGridViewEmployee.GetRowCellValue(selectedRowHandles[0], "ID"));
}
Code: for DataGridView Fill Using SQL Query (Only for Reference):
Code
private void Bind_GVhkCL(string text)
{
{
string query = "SELECT Room_No as 'Room No',Room_Status as 'Room Status', S_Time as 'Start Time',E_Time as 'End Time',c_date as 'Create Date'from HK_Chk " + text;
sqlConnection.Open();
SqlDataAdapter da = new SqlDataAdapter(query, sqlConnection);
DataTable dt = new DataTable();
da.Fill(dt);
GVhkCL.ItemsSource = dt;
//GVhkCL.RowHeight = 60;
sqlConnection.Close();
}
}
1条答案
按热度按时间ffdz8vbo1#
如果您花时间阅读DevExpress文档,您将看到
DataGridGestureEventArgs
有一个属性Item
取得对象,指定方格数据列所Map的数据来源项目。