Setting Textbox to Bold

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wayne  Wengert

    #1

    Setting Textbox to Bold

    I am trying to set the text in a textbox to Bold but I keep getting an error
    that 'Bold" is ReadOnly? My code is as follows:

    Dim N As New Form1()



    If CheckBox1.Check ed = True Then

    N.TextBox1.Font .Bold = True

    End If


    --
    ------------------------------------
    Wayne Wengert
    wayne@wengert.o rg


  • Jem

    #2
    Re: Setting Textbox to Bold

    The Font object is immutable, i.e. you cannot change it's properties
    individually. You can however create a new Font object that is the same in
    all other respects as the existing one and assign it to the Font property.
    If you keep switching between the two, you may wish to cache the two
    objects.

    Jem

    "Wayne Wengert" <wayne@wengert. org> wrote in message
    news:O3TjbgLQDH A.1216@TK2MSFTN GP11.phx.gbl...[color=blue]
    > I am trying to set the text in a textbox to Bold but I keep getting an[/color]
    error[color=blue]
    > that 'Bold" is ReadOnly? My code is as follows:
    >
    > Dim N As New Form1()
    >
    >
    >
    > If CheckBox1.Check ed = True Then
    >
    > N.TextBox1.Font .Bold = True
    >
    > End If
    >
    >
    > --
    > ------------------------------------
    > Wayne Wengert
    > wayne@wengert.o rg
    >
    >[/color]


    Comment

    Working...