How to bind constants to the designer completion menu

UncleRonin

Well-known member
Joined
Feb 28, 2006
Messages
230
Location
South Africa
Programming Experience
5-10
We all know what .Complete is and use it all the time. What I am trying to find out is if it is possible to somehow bind custom constants to the completion menu. Take for example the use of MessageBox. When specifying the parameters for the MessageBox buttons to be displayed a list of possible button selections is immediately displayed. Is it possible to somehow comment or bind constants within a class so that they will be displayed when using an associated method?

I'm guessing that there is a method but I can't find anyone who knows how. *scratch* Its really useful when designing classes and preventing user errors so it would be awesome if someone could post how. Thanks in advance!
 
Are you talking about enumerations?

VB.NET:
    Public Enum MyButtons
        OKButton = 0
        CancelButton = 1
        YesButton = 2
        NoButton = 3
    End Enum

    Private Sub DisplayMyButtons(ByVal ButtonType As MyButtons)
        MsgBox("You selected " & ButtonType.ToString)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        DisplayMyButtons(MyButtons.OKButton)
    End Sub

mybuttonsyq5.jpg
 
Last edited:
Back
Top