[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VS 2008 C# DataGridView screen question

Posted on 2011-03-23
8
Medium Priority
?
607 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:Rahul Agarwal
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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
 
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 2000 total points
ID: 35217559
you have to add rows to your datatable/dataset
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview
Suggested Courses

873 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