Hello,
I am trying to change the datagrid cellstyle alignment of a column in the designer. I set it to middle right but then I run it and it still aligned to the left. I have a lot of datagrids in my application but there are few that doesn't accept any alignment settings which I don't understand at all, can't see any reason, I been looking through the options if there is anything but can't find anything.
I just need one column of cells to be aligned to the right
whatever I do all of the columns are aligned left and there is an option in the defaultcellstyle that is sat to middle left, but when I try to change it to Not Set it doesn't change.
Any advice?
Thanks
well I can't change it at run time. I am not sure what means bound datagrid, but these are normal datagrids that a fill with data from the database, that's all.
Quote of the day from jmcilhinney:
'Talking about Option Strict and Option Explicit in the same sentence is pointless unless it is to say that they should both be On.'
Just noticed you asked how to do it in the designer. Not in code, as I provided.
If your dgv is bound to a Database, through a DataAdapter, DataTable, etc., Then I don't know how to changed the cell styles... except for doing so via code.
If you've added your Columns through the Designer you can adjust those properties if you click on the little box that comes up when you select the "Columns" property in the Property tool bar. Select the column in question and adjust its DefaultCellStyle property.
Quote of the day from jmcilhinney:
'Talking about Option Strict and Option Explicit in the same sentence is pointless unless it is to say that they should both be On.'
I have a feeling there is some option or I need to correctly configure the cellstyles, because either in designer or in code nothing is changing. What I can do is copy another datagrid that works fine with those and use it but that won't tell me the cause and I can't see the difference between them that work fine and those that doesn't let me modify the cellstyle.
Thanks anyway
I made a sample application with one of my datagrids copied, if anybody can change the defaultcellstyle for one of the columns please tell me how you do it , in code or in designer whichever.
Thanks