hello,
I want to underline all items in one column. My code does not work.
dgv.Columns(5).DefaultCellStyle.Font.Underline()
thanks.
hello,
I want to underline all items in one column. My code does not work.
dgv.Columns(5).DefaultCellStyle.Font.Underline()
thanks.
You weren't doing anything with it in your code sample. You have to assign it a value if you want to change it.
dgv.Columns(5).DefaultCellStyle.Font.Underline = True
Are you setting that property before or after inserting a value into the cell? I am not 100% sure, but, if memory serves, this will not change the style retroactively.
Looking at http://msdn.microsoft.com/en-us/library/system.drawing.font_members.aspx, it seems that Underline() is just a property that tells you if it's underlined. In C#, you might do
dgv.Columns(5).DefaultCellStyle.Font = new Font(dgv.Columns(5).DefaultCellStyle.Font, FontStyle.Underline);
but I don't know the VB syntax offhand.