Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A vertically-scrollable GroupBox

I am creating an application using Windows Application Forms. I'm basically new to C# and Visual Studio(Been using it since yesterday). So far, I've succeeded in creating a simplistic form as shown in the screenshot.

My Form

My Form Application

Background/Details

I am fetching data from a MySQL table using the IP provided in the box. This data is being loaded into a DataSet. Since last 10 hours, I've played around with displaying them into each one of these:

  • DataGridView
  • TableLayoutPanel

Putting them in the remaining part of the form windows. But both the outputs were not what I wanted them to be. One of the columns I am fetching is a VARCHAR ranging up to 190 chars. The final results in both the cases was not quite easy to read, which brings me to my question.

Question

So, now I am thinking of showing the text inside a GroupBox, with a vertical scroll-bar. The data from the DataSet can be displayed inside a Label or LinkLabel depending on the requirements.

Is this method feasible(time-optimization)? Is there some other kind of box/view which can satisfy my conditions? I'll be fetching and displaying at-most 225 rows from main table and at least 2 links for each of them fetched from another table(inside the foreach loop).

Please suggest me any other optimal solution for this job. Also, how can I add 200+ labels to a GroupBox and make the box vertically scrollable. As far as I can see in Visual Studio 2010, anything like VerticalScroll property doesn't exist for GroupBox.

like image 710
hjpotter92 Avatar asked Oct 16 '12 11:10

hjpotter92


2 Answers

Add a panel to Groupbox it has the Scrollable property or you can achieve it through RichTextBox

like image 144
andy Avatar answered Oct 10 '22 07:10

andy


Put everything inside an auto-sizing groupBox (AutoSize = True) and throw that groupBox inside a panel with the auto-scroll set (AutoScroll = True).

like image 4
TerriblePants Avatar answered Oct 10 '22 05:10

TerriblePants