Results 1 to 4 of 4

Thread: Creating Objects

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    5

    Unhappy Creating Objects

    I am trying to create an object that has several "Dimensions". 'For example, a text box has the following properties:
    MyTextBox.Font.Bold

    How would I go about making the above properties?


    What about assigning values?

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    Not sure what you are asking here.

    If you are creating a new class, you can inherit from the appropriate windows class and add any extras you require.

    You can set the values of the properties at design time and, if you do not want anyone to change them, you can make them "read only".

    Have you checked out the MSDN Help under "Classes"?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    This isn't compilable code, but all the text box is doing under the covers is something like this:

    Dim m_Font as Font
    Public Property Font() As Font
    Get
    Return m_Font
    End Get
    Set (value As Font)
    m_Font = value
    EndSet

    Basically it is holding a private font object (which has its own properties) and exposes it through a property.

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Here, this project will show you what I mean, the code compiles fine...
    Attached Files Attached Files

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