Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 265
  • Last Modified:

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
 
0
Vik Shah
Asked:
Vik Shah
  • 2
  • 2
  • 2
  • +1
1 Solution
 
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now