Link to home
Start Free TrialLog in
Avatar of Rowel Virgo
Rowel VirgoFlag for Philippines

asked on

How to set DataGridView Column size VB.net



       Dim cmd As New MySqlCommand
        Dim myDA As New MySqlDataAdapter(cmd)
        Dim myDT As New DataTable
        cmd.Connection = conn
        cmd.CommandText = "SELECT * FROM esd_user;"
        myDA.Fill(myDT)
        DataGridView2.DataSource = myDT

Open in new window


That's how I put data from server to Datagridview, how can I set the specific size for each column to fit it into the form ?

Thank you for the Help
Avatar of HainKurt
HainKurt
Flag of Canada image

set it like :

dataGridView.Columns(0)=60

Open in new window


DataGridViewColumn.Width Property
https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.width(v=vs.110).aspx
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rowel Virgo

ASKER

Thanks it works! I am now using a SQL, thanks for the TUT (links) sir
Please don't forget to close the question. Have a great day.
TY
Not a problem Rowell, glad to help.