我有一个要在新窗口中弹出的网格。我正在使用的代码如下。该表一直填充正确的数据。唯一的问题是,当新的winform弹出时,它立即消失了。此外,它不会在网格中显示数据。我无法弄清楚我做错了什么。有任何想法吗?
private void gridView1_ShowGridMenu(object sender, DevExpress.XtraGrid.Views.Grid.GridMenuEventArgs e)
{
GridView view = sender as GridView;
GridHitInfo hitInfo = view.CalcHitInfo(e.Point);
if (hitInfo.InRow)
{
var rowData = gridView1.GetRowCellValue(hitInfo.RowHandle, "SP");
string[] rowDataSplit = rowData.ToString().Split(':');
using (frmInterfaceLogSelection form = new frmInterfaceLogSelection(Services))
{
var sql = rowDataSplit[1].ToString();
var ds = Services.RunSql(sql);
var table = ds.FirstTable();
if (table == null)
{
var error = Services.LastSqlResultError;
if (error.Length > 0)
{
MessageBox.Show(error);
}
return;
}
table.AcceptChanges();
this.gridControl1.DataSource = table;
this.gridView1.Columns.BestFitAll();
form.Show();
}
}
}