Click here to Skip to main content
11,924,280 members (67,538 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB font
I have 2 buttons, a font combobox and a richtextbox. I want to increase the font size every time button1 is clicked. Just like in Microsoft Word. I tried with the following code:
RichTextBox1.SelectionFont = New Font(ComboBox1.Text,+2)

But it doesn't work.
Posted 16-Apr-12 10:18am
Edited 16-Apr-12 10:21am
SAKryukov 16-Apr-12 17:09pm
What do you mean by "VB" here? Is anything selected?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The question show lack of understanding of the very basics. First, +2 does not increase anything. This is merely an immediate contact, same as 2. First, did you pay attention for the property name: SelectionFont. Did you really wanted to increase the font in selection; or do you want to do it with the whole text? If nothing is selected, nothing can happen.

I don't see any sense in any advice except just one: you could stop developing of any UI and learn very basics of programming. Using, say, console applications and doing the simplest exercises to understand how basic things work: variables, methods, method parameters, classes and their properties: fields, properties and methods. Then — basics of OOP, interfaces, delegates and delegate instance and so on. Without all this stuff, doing any UI development is nearly useless, just a waste of time.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151125.3 | Last Updated 16 Apr 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100