Beginner question.

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

    #1

    Beginner question.

    How do i make the text in a button bold when it is
    clicked?

    I have tried
    me.font.bold = true

    but this does not work. Can anyone explain to me what i
    am doin wrong??


  • William Ryan

    #2
    Re: Beginner question.

    Me refers to the form...you'll need to set the Font Property of the button
    b/c The Bold property of the font is a boolean and read only.

    myButton.Font = New System.Drawing. Font("Microsoft Sans Serif", 8.25!,
    System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int, CType(0,
    Byte))
    "JD" <J@di> wrote in message news:015401c3bc 36$bab1b490$a40 1280a@phx.gbl.. .[color=blue]
    > How do i make the text in a button bold when it is
    > clicked?
    >
    > I have tried
    > me.font.bold = true
    >
    > but this does not work. Can anyone explain to me what i
    > am doin wrong??
    >
    >[/color]


    Comment

    • JD

      #3
      Re: Beginner question.

      Hi William,

      thx for the code example. Is this the only way to make
      the text bold? Im used to vb6

      mybutton.font.b old = true

      can i not do this in vb.net?

      I tried to edit your code to just make the text bold
      rather than set the fontstyle etc, but it did work!

      this is what i tried..

      myButton.Font = New System.Drawing. Font
      (System.Drawing .FontStyle.Bold )

      I not to clear on what the rest of the code does!!

      How do i make the text non-bold? do i use the true and
      false values of the bold property?

      thx
      [color=blue]
      >-----Original Message-----
      >Me refers to the form...you'll need to set the Font[/color]
      Property of the button[color=blue]
      >b/c The Bold property of the font is a boolean and read[/color]
      only.[color=blue]
      >
      >myButton.Fon t = New System.Drawing. Font("Microsoft Sans[/color]
      Serif", 8.25!,[color=blue]
      >System.Drawing .FontStyle.Bold ,[/color]
      System.Drawing. GraphicsUnit.Po int, CType(0,[color=blue]
      >Byte))
      >"JD" <J@di> wrote in message news:015401c3bc 36$bab1b490[/color]
      $a401280a@phx.g bl...[color=blue][color=green]
      >> How do i make the text in a button bold when it is
      >> clicked?
      >>
      >> I have tried
      >> me.font.bold = true
      >>
      >> but this does not work. Can anyone explain to me what i
      >> am doin wrong??
      >>
      >>[/color]
      >
      >
      >.
      >[/color]

      Comment

      • Ayende Rahien

        #4
        Re: Beginner question.


        "JD" <j@di> wrote in message news:060b01c3bc 5d$381f4660$a00 1280a@phx.gbl.. .[color=blue]
        > Hi William,
        >
        > thx for the code example. Is this the only way to make
        > the text bold? Im used to vb6
        >
        > mybutton.font.b old = true
        >
        > can i not do this in vb.net?[/color]

        No.
        [color=blue]
        > I tried to edit your code to just make the text bold
        > rather than set the fontstyle etc, but it did work!
        >
        > this is what i tried..
        >
        > myButton.Font = New System.Drawing. Font
        > (System.Drawing .FontStyle.Bold )[/color]

        This creates a deafult font with FontStyle.Bold.

        [color=blue]
        > I not to clear on what the rest of the code does!![/color]

        Create a spesific font with it's name and size spesified which is also bold.
        [color=blue]
        > How do i make the text non-bold?[/color]

        myButton.Font= New System.Drawing. Font(myButton.F ont,0)
        [color=blue]
        > do i use the true and
        > false values of the bold property?[/color]

        No, just for reading them
        [color=blue]
        >
        > thx
        >[color=green]
        > >-----Original Message-----
        > >Me refers to the form...you'll need to set the Font[/color]
        > Property of the button[color=green]
        > >b/c The Bold property of the font is a boolean and read[/color]
        > only.[color=green]
        > >
        > >myButton.Fon t = New System.Drawing. Font("Microsoft Sans[/color]
        > Serif", 8.25!,[color=green]
        > >System.Drawing .FontStyle.Bold ,[/color]
        > System.Drawing. GraphicsUnit.Po int, CType(0,[color=green]
        > >Byte))
        > >"JD" <J@di> wrote in message news:015401c3bc 36$bab1b490[/color]
        > $a401280a@phx.g bl...[color=green][color=darkred]
        > >> How do i make the text in a button bold when it is
        > >> clicked?
        > >>
        > >> I have tried
        > >> me.font.bold = true
        > >>
        > >> but this does not work. Can anyone explain to me what i
        > >> am doin wrong??
        > >>
        > >>[/color]
        > >
        > >
        > >.
        > >[/color][/color]


        Comment

        Working...