Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows forms show and showdialog working differently displaying datagridview

Status
Not open for further replies.

tshad

Programmer
Jul 15, 2004
386
US
I previously had a form that called another form that had a datagridview on it. I passed a DataTable to the child form and on the childform it bound it.

Parent calls child form and shows it.
TableInfoti = new TableInfo();
t1.Show();

Parent passes Datatable:
t1.ShowDataGrid(dt);

Child binds it to datagrid:
public void showDataGrid(DataTable dt, string type)
{
dgvTableColumns.DataSource = dt;
}

This works perfect.
But now I want to make this a modal form, so I change the t1.Show() to t1.ShowDialog() or t1.ShowDialog(this)

Now the grid is showing nothing on the Child form.

But if I change the code to do the ShowDialog after I call ShowGridView(), it works fine.

TableInfoti = new TableInfo();
t1.ShowDataGrid(dt);
t1.ShowDialog();

Why is the behavior different?

Thanks,

Tom


 
Are you converting this to ASP.NET?

If not, I think you meant to post it in this forum: forum796
 
I thought win forms was also part of asp.net.

We have both windows forms and Web forms.

And I am not using VB.net. I am using C#.
 
No, ASP.NET is a webform technology and is very different from winforms
you'd be best off posting here: forum732
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top