Simulating IntelliSense's parameter list for a function call (like MsgBox Button)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GGoldenborne
    New Member
    • Jan 2007
    • 3

    Simulating IntelliSense's parameter list for a function call (like MsgBox Button)

    Happy Friday, y'all!

    I am creating a function and want to have IntelliSense pop down the list of valid options for a certain parameter in the same way that the MsgBox function behaves when you are typing your argument for which buttons you wish to include (such as MsgBoxStyle.OkC ancel). I have done my best to search the internet but haven't found a thing which comes close to what I'm seeking. My monkeying around hasn't produced a satisfactory solution, yet, either.

    A related additional thing, which I can live without but that would be nice to have, is the description of the current parameter, which appears below the function description as shown highlighted below

    MsgBox (Prompt As Object, [Buttons as Microsoft.Visua l Basic.MsgBoxSty le = MsgBoxStyle .DefaultButton1], [Title as Object = Nothing]) As Microsoft.Visua lBasic.MsgBoxRe sult
    Buttons:
    Optional. Numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to user, the identity of the default button, and the modality of the message box. If you omit Buttons, the default is zero.
    This is my first post. I'm relatively new to VB .Net. I appreciate your assistance. :)
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    You don't have to 'simulate' this. That information comes from the attributes and smart comments you assign to a parameter.

    Code:
            /// <summary>
            /// Max number of times checking the dongle can fail before quitting the app
            /// </summary>
            [Description("Maximum number of failures before we throw a failure event. Must be > 0"),
            Category("Custom"),
            DefaultValue(10),
            Browsable(true)]
            public int MaxFailures
            {
                get
                {
                    return maxFail;
                }
                set
                {
                    if (value > 0) maxFail = value;
                }
            }
    XML comments in the /// will show up in Intelesense hothelp
    Attributes in the [ ] will show up in designer properties remark area.

    I suggest you try it this way.
    First build the complete property or method. Then go one line above it and type ///
    Intelesense will then stub in XML tags for description, parameters and return. All you have to do is complete the descriptions.

    You can define your own attributes, or use the stock ones like 'Description'.

    Comment

    • GGoldenborne
      New Member
      • Jan 2007
      • 3

      #3
      Thanks for the help! I'm on the right track now. (I'm just working out the differences a little from your example which is some flavor of C, I think, to VB.) I really appreciate it. You've made my day!

      Comment

      • BeeBob12
        New Member
        • Jun 2010
        • 2

        #4
        ???

        GGoldenborne:
        Can you show me how to do it, I still don't get it?
        I don't understand the C example :-(

        :-)

        Comment

        • BeeBob12
          New Member
          • Jun 2010
          • 2

          #5
          Arghhh, got it!

          Arghhhh, GOT IT!

          For others: You make XML comments in vb.net using '''

          Example:
          ''' <summary>
          ''' This is a test comment
          ''' </summary>
          ''' <param name="Str1">Typ e in some text</param>
          ''' <param name="Str2">Typ e in some more text</param>
          ''' <returns></returns>
          ''' <remarks></remarks>
          Function TEST(ByVal Str1 As String, ByVal Str2 As String) As String
          Return Str1 And Str2
          End Function

          Comment

          • GGoldenborne
            New Member
            • Jan 2007
            • 3

            #6
            That's exactly correct, BeeBob12! Good work. :-)

            Comment

            Working...