My first column does not align to center, although the sub-columns aligns perfectly

Listview1.Columns.Add("Column1", 100, HorizontalAlignment.Center)
Listview1.Columns.Add("Column2", 100, HorizontalAlignment.Center)
Listview1.Columns.Add("Column3", 100, HorizontalAlignment.Center)

Recommended Answers

You can't change the alignment of 1st column.

Listview1.Columns.Add("",0, HorizontalAlignment.Center)
Listview1.Columns.Add("Column1", 100, HorizontalAlignment.Center)
Listview1.Columns.Add("Column2", 100, HorizontalAlignment.Center)
Listview1.Columns.Add("Column3", 100, HorizontalAlignment.Center)
ListView1.Columns.RemoveAt(0)
Jump to Post

All 4 Replies

You can't change the alignment of 1st column.

Listview1.Columns.Add("",0, HorizontalAlignment.Center)
Listview1.Columns.Add("Column1", 100, HorizontalAlignment.Center)
Listview1.Columns.Add("Column2", 100, HorizontalAlignment.Center)
Listview1.Columns.Add("Column3", 100, HorizontalAlignment.Center)
ListView1.Columns.RemoveAt(0)
commented: :) +12

Thanks

I have struggled lot to resolve this issue finally using this code, I have done. Thanks a lot dude.

Thanks for the Codes. I'm new in VB.net and finding Daniweb solves some of my problem :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.