Solved

DataGridView

Posted on 2016-10-20
2
28 Views
Last Modified: 2016-10-21
VB.NET desktop app.   I'm using DataGridView.  How do I fix the column widths independent of the datasource and the size of the data in each column?  I'm using say width = 200 which seems to work initially, but then when I reset the DataSource property the widths seem to change,
0
Comment
Question by:HLRosenberger
2 Comments
 
LVL 27

Accepted Solution

by:
Ark earned 500 total points
Comment Utility
Try      
DataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None
'or
For i = 0 To DataGridView1.Columns.Count - 1
    DataGridView1.AutoResizeColumn(i, DataGridViewAutoSizeColumnMode.NotSet)
Next

Open in new window

0
 
LVL 1

Author Closing Comment

by:HLRosenberger
Comment Utility
Thanks did the trick. Thanks!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now