Solved

VS 2008 C# DataGridView screen question

Posted on 2011-03-23
8
594 Views
Last Modified: 2013-12-17
This is a aesthetics question. If you look at the bottom of the attached screenshot, you will see what happens when a user scrolls all the way down to the bottom of my datagridview. I want to prevent the appearance of the empty space at the bottom. This is the stripe just below the bottom of the datagrid.Is there some way to force a certain amount of rows and have the vertical slider move only between the top and bottom row?
ViewOrderProfitMargin-II.jpg
0
Comment
Question by:rwheeler23
  • 4
  • 3
8 Comments
 
LVL 13

Expert Comment

by:agarwalrahul
ID: 35204272
If you want to prevent the user not to view the last empty row just uncheck the Enable Adding property in DataGridView by right click on  play button on top right corner in DataGridView.
0
 

Author Comment

by:rwheeler23
ID: 35205873
I will give that a shot. I think my problem is more of a sizing issue. When they drag the slider all the way to the bottom I want to prevent that little gray area from appearing.
0
 
LVL 11

Expert Comment

by:Deepak Lakkad
ID: 35206028
Hi

I think this will not be possible

- Deepak
0
 

Author Comment

by:rwheeler23
ID: 35207011
In testing I discovered a bigger issue. Let's say there was only one line on the order, then I get a big gray area at the botton plus the vertical slider does not appear at all. Is there any way to force a certain amount of lines to be displayed plus always have the vertical slider appear?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 11

Expert Comment

by:Deepak Lakkad
ID: 35212833
Hi

following link will help you to set Always on Vertical Scrollbar

http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23144301.html

and following code will help you to add blank rows to your datagridview

' it's adding 10 rows to DataGridView1
For i As Integer = 1 To 10 
        DataGridView1.Rows.Add()
Next

Open in new window


- Deepak Lakkad
0
 

Author Comment

by:rwheeler23
ID: 35215190
I tried adding lines as per your example but they do not appear. Is there something else I need to do?
try
            {
                GPDataAdapter = new System.Data.SqlClient.SqlDataAdapter();
                GPDataAdapter.SelectCommand = GPCommand;
                GPDataAdapter.TableMappings.Add("Table", "OrderDetail");

                GPDataAdapter.Fill(GPDataSet);

                /* it's adding 10 rows to dgvOrderDetail */
                {
                    for (int i = 1; i <= 10; i++)
                    {
                        dgvOrderDetail.Rows.Add();
                    }
                }

            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }

Open in new window

0
 

Author Comment

by:rwheeler23
ID: 35216106
This datagrid is databound so I am not allowed to add rows to a databound control. Is there a way to add blank rows to a databound datagridview?
0
 
LVL 11

Accepted Solution

by:
Deepak Lakkad earned 500 total points
ID: 35217559
you have to add rows to your datatable/dataset
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now