954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Change font of listbox

Guys can anyone tell me how to change fontsize of my listbox programmatically? This code does not work

listbox1.font.size = 10

or

listbox1.font.size = new size 10

What is the right code?

markdean.expres
Junior Poster
152 posts since Aug 2010
Reputation Points: 10
Solved Threads: 1
 

try with:

listBox1.Font = New Font("Arial", 10, FontStyle.Regular)
Mitja Bonca
Nearly a Posting Maven
2,485 posts since May 2009
Reputation Points: 641
Solved Threads: 474
 

If you want to retain the current font but just change the size you can use

listBox1.Font = New System.Drawing.Font(listBox1.Font.Name, fontsize)

And specify your desired value for fontsize.

Reverend Jim
Posting Shark
Moderator
1,169 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You