Form Size

hi

I have a program which return some data as DataTable
then I put the DataTable in the DataGridView
and the view is added to the Form for display
the problem is :
the DataTable returned  have different rows each time, so the height is different
how can I set the form to expand the form size automatically ??

thanks
 
Vik ShahLead .Net Web Developer / AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alexandre SimõesManager / Technology SpecialistCommented:
So you don't want to have any scroll bars on the GridView control?
0
YurichCommented:
I would advise you against doint it - what size the form are you going to set for 2000 rows?? I'd rather have a scrollbar, which is a default option for a datagrid. You're talking about adding DataGridView to the form, I'd suggest it's in 2005, as it's not an option in 2003. There would be a scroll bar for that one as well i suggest.

good luck,
yurich
0
Alexandre SimõesManager / Technology SpecialistCommented:
Try not to reinvet the wheel...
Users are used to have grids with scrollbars on every other applications.

wouldn't it be worst if the resizing of the window would make it bigger than the screen bounds?

Thank about it.

Alex :p
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

dkloeckCommented:
I would suggest scroll bars too, but maybe you know you only will have about 10 rows or something so here goes the code to resize the form:

put this line in the form code where you get the Nr of rows:

this.Size = new Size(Width, Height);

Width of course is the width of the form, end height..yes you know :)

u can calculate the height by for example NrofRows * (heighth of row) +EverythingButTheRowsConstantHeight
0
Vik ShahLead .Net Web Developer / AnalystAuthor Commented:
seems that all of them suggest to have scrollbar.
so I think I have to use the scrollbar.

and as of the points..it's hard to decide who should I give it to...
since AlexCode is the first one response, so I would give it to him...
hope Yurich and dkloeck don't mind
0
YurichCommented:
I have the same time for Alex and myself - there is the split points option for your future reference...
0
Vik ShahLead .Net Web Developer / AnalystAuthor Commented:
Yurich
Thank you for telling me about the split point...
I didn't know that before..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.