Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RESOURCEFILES & FONT

Status
Not open for further replies.

Denaeghel

Programmer
Apr 23, 2001
61
BE
When using a resource file, some of my captions that have to be uppercase, bold, etc. aren't, and the ones that aren't supposed to be bold, are...

This is the code I used:

-->in a global module:

Sub LoadResStrings(frm As Form)
On Error Resume Next


Dim ctl As Control
Dim obj As Object
Dim fnt As Object
Dim sCtlType As String
Dim nVal As Integer


'set the form's caption
frm.Caption = LoadResString(CInt(frm.Tag))


'set the font
Set fnt = frm.Font
'fnt.Bold = False
fnt.Name = LoadResString(20)
fnt.Size = CInt(LoadResString(21))


'set the controls' captions using the caption
'property for menu items and the Tag property
'for all other controls
For Each ctl In frm.Controls
Set ctl.Font = fnt
sCtlType = TypeName(ctl)
If sCtlType = "Label" Then
ctl.Caption = LoadResString(CInt(ctl.Tag))
ElseIf sCtlType = "Menu" Then
ctl.Caption = LoadResString(CInt(ctl.Caption))
ElseIf sCtlType = "TabStrip" Then
For Each obj In ctl.Tabs
obj.Caption = LoadResString(CInt(obj.Tag))
obj.ToolTipText = LoadResString(CInt(obj.ToolTipText))
Next
ElseIf sCtlType = "Toolbar" Then
For Each obj In ctl.Buttons
obj.ToolTipText = LoadResString(CInt(obj.ToolTipText))
Next
ElseIf sCtlType = "ListView" Then
For Each obj In ctl.ColumnHeaders
obj.Text = LoadResString(CInt(obj.Tag))
Next
Else
nVal = 0
nVal = Val(ctl.Tag)
If nVal > 0 Then ctl.Caption = LoadResString(nVal)
nVal = 0
nVal = Val(ctl.ToolTipText)
If nVal > 0 Then ctl.ToolTipText = LoadResString(nVal)
End If
Next
End Sub

-->In every formload: LoadResStrings Me

All the captions are correct, but the fonts aren't...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top