Hi,

I have a form with tab control in it and in on of the tabs I got a datagrid.

On runtime, whenever I try to display data on the datagrid from a database, the datagrid "jumps" from the tab to the form itself so the tab hides most of it.

What am I doing wrong?

Thanks,
Udi

I dont understand. Can you do some pictures, that I can see what do you menan?

I dont understand. Can you do some pictures, that I can see what do you menan?

Hi,

you can see in the picture that the datagrid is in background, and not inside the tab control...

You didnt put the dataGrid on the tab control, but on the main form.

You didnt put the dataGrid on the tab control, but on the main form.

I did put it on the tab control, look:

Give me all the project, otherwise I cannot help you out. Upload it somewhere and give me the link (you can even pm me).
Mitja

Hi,

I've found out what I was doing wrong. I wrote in the code:

this.controls.add(datagridview1)

When I should have written:

tabpage2.controls.add(datagridview1)

That's why it appeared on form1 and not on the tabpage.

Thanks for your help!

You didnt put the dataGrid on the tab control, but on the main form.

Didn`t I tell you the same as you have find out now by your self?
Plase, be a bit more careful next time.
And mark the thread answered.

bye,
Mitja

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.