Hi, is it possible to code column header in listview during run time?
can you please give me some idea on this.Thank you in advance.
If you go into design view, right click on the listview and select "Edit Columns" you will see the names of all the columns (you can change these names). You can use these names to modify the header text at runtime as in
ColumnHeader1.Text = "new header text"
If you need to add column headers at runtime, I've found the best way to find out how this is done is to create the headers at design time, then look at the contents of Form1.Designer.vb in your project folder (replace Form1 with your actual form name if different). This file contains the code to create the controls. You can use the same code at runtime.
@Reverend Jim, Thank you for the reply,but any alternative way to code on it...I tried your first solution the edit columns, but i have no idea on how to make column header to code...
Does this help
Dim newheader As New System.Windows.Forms.ColumnHeader
newheader.Text = "my text"
newheader.Width = 60
ListView1.Columns.Add(newheader)
Thank you so much.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.