VS 2008 C# DataGridView screen question

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
rwheeler23Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Deepak LakkadConnect With a Mentor Commented:
you have to add rows to your datatable/dataset
0
 
Rahul AgarwalTeam LeaderCommented:
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
 
rwheeler23Author Commented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Deepak LakkadCommented:
Hi

I think this will not be possible

- Deepak
0
 
rwheeler23Author Commented:
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
 
Deepak LakkadCommented:
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
 
rwheeler23Author Commented:
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
 
rwheeler23Author Commented:
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
All Courses

From novice to tech pro — start learning today.