473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to exactly and evenly fit all rows within the DataGridView display?

I have spent several hours, but not yet able to figure out how to make
the rows fit evenly within the display area *without* scrollbars. A
code snippet is as follows:

For i As Integer = 0 To 44
Dim colName As String = (DirectCast(ChrW(i + start),
Char)).ToString()
Dim index As Integer = dgShmoo.Columns.Add(i, String.Empty)
dgShmoo.Columns(i).SortMode =
DataGridViewColumnSortMode.NotSortable
dgShmoo.Columns(i).Width = 75
Next

For i As Integer = 0 To 5
dgShmoo.Rows.Add()
Next

dgShmoo.RowsDefaultCellStyle.BackColor = Color.Red
dgShmoo.AlternatingRowsDefaultCellStyle.BackColor =
Color.LawnGreen

dgShmoo.AutoSizeColumnsMode =
DataGridViewAutoSizeColumnsMode.Fill

dgShmoo.AllowUserToAddRows = False
dgShmoo.AllowUserToDeleteRows = False
dgShmoo.AllowUserToOrderColumns = True
dgShmoo.ReadOnly = True
dgShmoo.SelectionMode =
DataGridViewSelectionMode.RowHeaderSelect
dgShmoo.MultiSelect = False
'dgShmoo.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None
dgShmoo.AllowUserToResizeColumns = False
dgShmoo.ColumnHeadersHeightSizeMode = _
DataGridViewColumnHeadersHeightSizeMode.DisableRes izing
dgShmoo.AllowUserToResizeRows = False
dgShmoo.RowHeadersWidthSizeMode = _

DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisp layedHeaders
dgShmoo.AutoSizeRowsMode = _
DataGridViewAutoSizeRowsMode.AllCells
dgShmoo.ColumnHeadersVisible = False
dgShmoo.RowHeadersVisible = False

Regards

Jul 21 '06 #1
0 1150

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Old Wolf | last post by:
I have a site that I laid out with tables, and lots of grotty hacks and lots of markup generated by client-side javascript. I'm in the process of converting it to "nice" CSS code but have got...
3
by: Rich | last post by:
Hello, I am populating a datagridview from a datatable and filtering the number of rows with a dataview object. Is there a way to retrieve the rows displayed by the datagridview into a separate...
1
by: John | last post by:
Hi, Is there a simple way to swap the position of two rows in an unbound DataGridView? I am using it to display an ordered list, where I want the up/down arrow keys to shuffle a row up and down...
0
by: romancoelho | last post by:
Hey everyone, I know this has to be simple, but can't figure out how to do it. How can I display the grid lines in all rows in the gird. The default behavior of the DataGridView seems to be that it...
5
by: Hopp Family | last post by:
Here's the problem. I want to display a known number of images, evenly spaced out across the width of a div. (The images are not all the same width; the centers should be evenly spaced.) The div...
4
by: craig.wenger | last post by:
I am using a DataGridView to display information stored in classes. I am linking to the information with the Tag property of the DataGridView rows. Unfortunately, whenever I set the Tag property,...
3
by: frostbb | last post by:
Greetings: Working on a VS2005 C# program. I have a DataGridView control that is bound to dataviews generated by various database queries. i.e. the user enters search criteria and the query...
1
by: SePp | last post by:
Hello all, I want to display the number of items in an datagridview. I use this one datagridview for different datasets. The datagridview.Rowcount works fine for the most of the dataset. But...
0
by: ZSvedic | last post by:
Hi all, I need to display DataRows with RowState.Deleted inside DataGridView, in a way that such rows have strikethrough font. Here is the screenshot how it should look like:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.