locked
Base classes with VB.Net 2010 RRS feed

  • Question

  • I am using VB.Net 2010.

    I used to code in Foxpro. Back then, I could create my own forms, textboxes, checkboxes etc etc . . . These basic forms had the fonts, company logo and basic code. When I went to create a new form, instead of using what shipped with Microsoft, I used my forms.

    How can I drag and drop my own tailor made textbox onto a form. Or put another way. How can I replace Microsoft stuff with my stuff.

    Monday, October 15, 2012 12:55 AM

Answers

  • you need add component which you made, into your project. it will apear on the toolbox. or in VB.Net you also can create a custom control.
    http://msdn.microsoft.com/en-us/library/windows/desktop/bb775501(v=vs.85).aspx
    • Proposed as answer by Mark Liu-lxf Tuesday, October 16, 2012 2:23 AM
    • Marked as answer by Mark Liu-lxf Tuesday, October 23, 2012 8:16 AM
    Monday, October 15, 2012 1:35 AM
  • in vb.net you can inherit + extend controls:

    Public Class yourTextBox
        Inherits TextBox
    
        Public Overrides Property Font() As Font
            Get
                Return New Font("Arial", 12, FontStyle.Regular, GraphicsUnit.Pixel, Nothing)
            End Get
            Set(ByVal value As Font)
                'nothing
            End Set
        End Property
    
        'you can override properties or add your own properties in this class
        'after adding this class + rebuilding your project, you'll find yourTextBox 
        'at the top of your toolbox
    
    End Class


    thanks for any help

    • Proposed as answer by Mark Liu-lxf Tuesday, October 16, 2012 2:23 AM
    • Marked as answer by Mark Liu-lxf Tuesday, October 23, 2012 8:16 AM
    Monday, October 15, 2012 1:46 AM

All replies

  • you need add component which you made, into your project. it will apear on the toolbox. or in VB.Net you also can create a custom control.
    http://msdn.microsoft.com/en-us/library/windows/desktop/bb775501(v=vs.85).aspx
    • Proposed as answer by Mark Liu-lxf Tuesday, October 16, 2012 2:23 AM
    • Marked as answer by Mark Liu-lxf Tuesday, October 23, 2012 8:16 AM
    Monday, October 15, 2012 1:35 AM
  • in vb.net you can inherit + extend controls:

    Public Class yourTextBox
        Inherits TextBox
    
        Public Overrides Property Font() As Font
            Get
                Return New Font("Arial", 12, FontStyle.Regular, GraphicsUnit.Pixel, Nothing)
            End Get
            Set(ByVal value As Font)
                'nothing
            End Set
        End Property
    
        'you can override properties or add your own properties in this class
        'after adding this class + rebuilding your project, you'll find yourTextBox 
        'at the top of your toolbox
    
    End Class


    thanks for any help

    • Proposed as answer by Mark Liu-lxf Tuesday, October 16, 2012 2:23 AM
    • Marked as answer by Mark Liu-lxf Tuesday, October 23, 2012 8:16 AM
    Monday, October 15, 2012 1:46 AM