Solved

VS 2008 C# DataGridView screen question

Posted on 2011-03-23
8
599 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why use this lambda? 12 93
Create a Dropdown list with sub group 10 39
Adjust the codes 3 60
PowerShell: Adding ToGB to a script 4 68
IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 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