View Full Version : Solved: change fontstyle w/ combobox
Trevor
04-07-2008, 01:54 PM
I'm trying to change the font style(fontweight) with a combo box, where is what I have, seems like it should work, but I keep getting type mismatch 13 error, the combobox value list is "Bold", "Normal"
Private Sub LabelFont_onChange()
Me.LabelBox.FontWeight = Me.LabelFont
End Sub
Thanks for helping in advance
Carl A
04-07-2008, 03:09 PM
Values for the weight property is a integer value from 1 to 1000
Private Sub cmbFontName_AfterUpdate()
Me.LabelFont.FontWeight = cmbFontName.Value
End Sub
Private Sub Form_Load()
With cmbFontName
.AddItem "100" 'Thin
.AddItem "200" 'Extra Light
.AddItem "300" 'Light
.AddItem "400" 'Normal
.AddItem "500" 'Medium
.AddItem "600" 'Semi-Bold
.AddItem "700" 'Bold
.AddItem "800" 'Extra-Bold
.AddItem "900" 'Heavy
End With
End Sub
From the Help Files:
Changing the value of Bold also changes the value of Weight. Setting Bold to True sets Weight to 700; setting Bold to False sets Weight to 400. Conversely, setting Weight to anything over 550 sets Bold to True; setting Weight to 550 or less sets Bold to False.
You may be better off just using the bold property.
Trevor
04-08-2008, 08:48 AM
Thanks carlA that works greate, don't know how I miss "simple" things like this (it seems that every propory w/ list of option also has a 3 digit corresponding value in relation to its posistion in the list.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.