Missing Default Property

First I must apologize - I am new to VB5. I come from a VB6 background and thrown into a VB2005 project and I'm looking for something so simple...the default property. I found where you set the Cancel Button option, but I can't find the default property as it was available in VB6. I've even tried to set it in code, but that is unavailable either.

Am I missing something here Did they take that away from me

Any help is appreciated.

Bob



Answer this question

Missing Default Property

  • snakeoooooo

    I think what you're looking for is the AcceptButton property.

    Tony


  • centexbi

  • Huckster

    Thanks Brendan, I understand all that. However where I am a little lost is when you look at the properties for the command button, there is no boolean 'Default' property to select that will execute the button_click event. I was wondering if there was a problem with my install, or a property was lost in the upgrade from 2003 to 2005, etc...

    If you have other ideas, let me know.

    Thanks


  • Marius Onofrei

    Add the default keyword to the declaration of the property... so this:

            Public Property SomeNumber(ByVal index As Integer) As Integer

                Get

                    Return m_SomeNumber(index)

                End Get

                Set(ByVal Value As Integer)

                    m_SomeNumber(index) = Value

                End Set

            End Property

    becomes this:

            Default Public Property SomeNumber(ByVal index As Integer) As Integer

                Get

                    Return m_SomeNumber(index)

                End Get

                Set(ByVal Value As Integer)

                    m_SomeNumber(index) = Value

                End Set

            End Property

    Is this what you are looking for

    Edit: You might also consider the DefaultProperty attribute.



  • jambi

    Thanks guys - that is exactly what I was looking for!
  • Missing Default Property