Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dynamic Form from Console App?

0 views
Skip to first unread message

SnapDive

unread,
Dec 14, 2009, 10:26:10 PM12/14/09
to

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
}

Family Tree Mike

unread,
Dec 14, 2009, 10:50:18 PM12/14/09
to

Use theview.ShowDialog() rather than theview.Show().

--
Mike

0 new messages