I have a Framework 3.5 x86 console application that gets some stuff
from a database. I want to add a WinForm with a DataGridView that will
pop-up to display the data. I added a form to my console app project
and added the DataGridView control to the form. I can get my data and
instance the form, but it disappears before I can see anything and the
DataGridView is not visible. I think I am missing something simple,
can anyone show me how to make the Winform appear modally and when I
click [x] the console app continues?
Thanks.
// ... data fetching code ...
// myDataSet has a DataTable with 200 rows called "fruit";
frmViewStuff theview = new frmViewStuff();
theview.Show();
DataGridView activeView = ( (DataGridView)uiView.Controls.Find(
"gridviewData" , true )[0] );
activeView.DataSource = myDataSet.Tables["fruit"];
int ee = activeView.RowCount; // debugger shows 201 rows
}
Use theview.ShowDialog() rather than theview.Show().
--
Mike