Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DataGridView

Posted on 2016-10-20
2
Medium Priority
?
57 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
[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
2 Comments
 
LVL 28

Accepted Solution

by:
Ark earned 2000 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

722 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