Solved

DataGridView

Posted on 2016-10-20
2
33 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
ID: 41853045
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
ID: 41854387
Thanks did the trick. Thanks!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 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

25 Experts available now in Live!

Get 1:1 Help Now