Results 1 to 6 of 6

Thread: [RESOLVED] Need Few Addition on Usercontrol.....

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Posts
    84

    Resolved [RESOLVED] Need Few Addition on Usercontrol.....

    i have extended Listbox control below attached....... how shall i add font property & appearance property to user control

    i have never worked with usercontrol plz help !!

  2. #2
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Need Few Addition on Usercontrol.....

    Maybe this will help with the font part? Adding a Font Object to Your User Control

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Posts
    84

    Re: Need Few Addition on Usercontrol.....

    but i have a listbox on that usercontrol...... of which i need to change font !!

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Posts
    84

    Re: Need Few Addition on Usercontrol.....

    Code:
    Public Property Get Font() As StdFont
        m_Font = ListBox.Font
    End Property
    
    Public Property Let Font(ByVal NewFont As StdFont)
        NewFont = m_Font
        ListBox.Font = NewFont
    End Property

    then it says object with varible not set

  5. #5
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Need Few Addition on Usercontrol.....

    I just slapped this together, it should allow you to set the font in design mode (and remembers the setting) as well as setting it at runtime,

    i.e..@ runtime ...If Control name is UC ....
    UC.Font = "Arial"
    UC.FontSize = 18
    UC.FontBold = True
    UC.FontItalic = True

    In design mode just double click/select "Font" in Properties and set.
    Hope that helps.
    Attached Files Attached Files

  6. #6
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Need Few Addition on Usercontrol.....

    StdFont is an object, try to use with Set keyword.
    Code:
        Set NewFont = m_Font
        Set ListBox.Font = NewFont
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width