Member Avatar for westsiderailway

Hello everyone,

was looking to see what was availble in listview1.columns.add....
and found this

 ListView1.Columns.Add("ID", FontDialog, HorizontalAlignment.Center)

how would i use this to change the font in listview columns.?
the rest of the code...

      ListView1.Columns.Add("Weekday", 100, HorizontalAlignment.Left)
        ListView1.Columns.Add("Fuel Date", 80, HorizontalAlignment.Left)
        ListView1.Columns.Add("Fuel Time", 80, HorizontalAlignment.Left)
        ListView1.Columns.Add("Location", 60, HorizontalAlignment.Left)
        ListView1.Columns.Add("Pump", 50, HorizontalAlignment.Center)
        ListView1.Columns.Add("Total Liters", 80, HorizontalAlignment.Left)
        ListView1.Columns.Add("Total Dollars", 80, HorizontalAlignment.Left)

Thanks for reading. :-)


I haven't seen that constructor before when adding columns and did a check and still can't see it. Can you provide a screen shot or more info on this?

In terms of using a Font however, you can apply a Font style when adding items to the ListView. For example:

Dim fd As New FontDialog
Dim newFont As Font

If fd.ShowDialog = Windows.Forms.DialogResult.OK Then newFont = fd.Font

For i As Integer = 1 To 10
    ListView1.Items.Add("Value " & i.ToString).Font = newFont


Be a part of the DaniWeb community

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