Re: DatagridView column size
Code:
DataGridView1.Columns(columnIndex).Width = 100
Re: DatagridView column size
seems you've already found how???:
Code:
MakbuzTDataGridView.Columns(1).Width = 150
Re: DatagridView column size
Thanks for the reply. Yes, I tried it, it doesn't work.
Re: DatagridView column size
in the first line of Form1_Load, put Stop.
then run the code, when it stops, step through the code (F11)
are there any unexpected problems?
Re: DatagridView column size
no, there isn't any problems
Re: DatagridView column size
But I'm getting a warning:
http://img708.imageshack.us/img708/8901/gcjl.png
Uploaded with ImageShack.us
at this line: Me.MakbuzTTableAdapter.Fill(Me.MakbuzDataSet.makbuzT)
Re: DatagridView column size
just click yes on the dialog.
after:
Code:
MakbuzTDataGridView.Columns(1).Width = 150
put:
Code:
MsgBox(MakbuzTDataGridView.Columns(1).Width)
Re: DatagridView column size
Re: DatagridView column size
the DataGridViewColumn has 2 properties that would affect this... Resizable + AutoSizeMode
Re: DatagridView column size
I tried:
Code:
MakbuzTDataGridView.Columns(1).Resizable = False
MakbuzTDataGridView.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.None
MakbuzTDataGridView.Columns(1).Width = 150
Same thing
Re: DatagridView column size
I can't recreate your problem, so there's nothing more I can think of to suggest...
Re: DatagridView column size
Re: DatagridView column size
are you sure that the column you're expecting to be at index 1 is in fact index 1?
if you have any hidden columns or reordered columns, you could be looking at the wrong column
Re: DatagridView column size
:) just a stupid mistake. thanks a lot.
Re: DatagridView column size
last guess - I think you'll probably find you need to adjust the column width after setting your datasource