Problem with dialog box!!!!

A

AA

Hi! I'm going through a visual basic book and on that
book the following code is listed. My question is why
can't we just directly use FontName, FontSize, FontBold,
FontItalic and FontUnderline property of Label class for
LblMessage? Why do we use 'special' property Font for
LblMessage from Line#6-10 and then use FontStrikethru and
ForeColor(on Line#11-12) without mentioning Font property
(for LblMessage)? I'm new to this programming language so
can anyone explain this problem step by step? Thanks.


1: ' Set the Font Flags property.
2: CdbFont.Flags = cdlCFBoth Or cdlCFEffects
3: CdbFont.ShowFont ' Display the Font DB
4: ' Set a label's properties to the
5: ' user's selected font information
6: LblMessage.Font.Name = CdbFont.FontName
7: LblMessage.Font.Size = CdbFont.FontSize
8: LblMessage.Font.Bold = CdbFont.FontBold
9: LblMessage.Font.Italic = CdbFont.FontItalic
10: LblMessage.Font.Underline = CdbFont.FontUnderline
11: LblMessage.FontStrikethru = CdbFont.FontStrikethru
12: LblMessage.ForeColor = CdbFont.Color
 
O

One Handed Man

You need to examine the properties and methods of the Font class.

Font.Name is a readonly member so line 6 will not work anyway, wheraes the
Font property allows you to Set the font.

HTH

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
A

Armin Zingler

AA said:
Hi! I'm going through a visual basic book and on that
book the following code is listed. My question is why
can't we just directly use FontName, FontSize, FontBold,
FontItalic and FontUnderline property of Label class for
LblMessage? Why do we use 'special' property Font for
LblMessage from Line#6-10 and then use FontStrikethru and
ForeColor(on Line#11-12) without mentioning Font property
(for LblMessage)? I'm new to this programming language so
can anyone explain this problem step by step? Thanks.


1: ' Set the Font Flags property.
2: CdbFont.Flags = cdlCFBoth Or cdlCFEffects
3: CdbFont.ShowFont ' Display the Font DB
4: ' Set a label's properties to the
5: ' user's selected font information
6: LblMessage.Font.Name = CdbFont.FontName
7: LblMessage.Font.Size = CdbFont.FontSize
8: LblMessage.Font.Bold = CdbFont.FontBold
9: LblMessage.Font.Italic = CdbFont.FontItalic
10: LblMessage.Font.Underline = CdbFont.FontUnderline
11: LblMessage.FontStrikethru = CdbFont.FontStrikethru
12: LblMessage.ForeColor = CdbFont.Color

If this code works, you are in the wrong group. This is a VB.NET group.
Older versions are handled at microsoft.public.vb.*
 
H

Herfried K. Wagner [MVP]

AA said:
can't we just directly use FontName, FontSize, FontBold,
FontItalic and FontUnderline property of Label class for
LblMessage? Why do we use 'special' property Font for
LblMessage from Line#6-10 and then use FontStrikethru and
ForeColor(on Line#11-12) without mentioning Font property
(for LblMessage)? I'm new to this programming language so
can anyone explain this problem step by step?

This seems to be a VB6 question:

news://news.microsoft.com/microsoft.public.vb.controls
 
Top