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?

try with:

listBox1.Font = New Font("Arial", 10, FontStyle.Regular)

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.

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.