[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

VS 2008 C# DataGridView screen question

Posted on 2011-03-23
8
Medium Priority
?
604 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: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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

656 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