Solved

DataGridView

Posted on 2016-10-20
2
44 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 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
Import a excel sheet in a grid 2 45
SSIS - Using VB.NET to parse XML file 11 42
Subtract dates in vb.net 6 35
Delete command SQLdatasource in asp.net, vb 2 26
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

751 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