Results 1 to 10 of 10

Thread: coding parameter constants ?? resolved

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    193

    Cool coding parameter constants ?? resolved

    Hi intelligent Ones,
    This may sound dumb, but I really have no idea. I want to create a function that has constant variable in it. Like the msgbox, where I can either use a 0 or click on the "VBOKOnly" from a drop down menu. I wnat something that will explain a variety of functions. ie 0 means "turn left at the next street", 1 means "Turn left after the next street", and the user would enter other variables, like distances. I am sure this is easy, but an example would help me understand how this works. Also what is the official name for this THING????? don't even know what to search for for help??
    Thanks so much.
    Last edited by DebbieInFlorida; Sep 12th, 2005 at 04:17 PM. Reason: resolved

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: coding parameter constants ??

    in a bas module declare your constants

    like

    Public Const TURNLEFT as Integer = 1
    or
    Public Const TURNLEFT = 1

    Public Cont CONSSTRING = "TEST"

    etc...

    then throught your app
    TURNLEFT = 1

    if x = TURNLEFT then etc...

    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3
    Fanatic Member THEROB's Avatar
    Join Date
    Oct 2000
    Location
    I'm cold and there are wolves after me
    Posts
    575

    Re: coding parameter constants ??

    VB Code:
    1. Private Enum eTurns
    2.     eTurn_left_at_the_next_street = 0
    3.     eTurn_left_after_the_next_street = 1
    4. End Enum
    5. Private Function Whatever(eTurn As eTurns)
    6.  
    7. End Function
    My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    193

    Re: coding parameter constants ??

    Therob, I think what you have is close to what I want, Sorry Static, but I do know about constant values. ANyway, I still am a little fussy about how to have the constants and the parameters in the same variable string.

    Private Function Whatever(eTurn As eTurns, DistanceLeft as double, distanceRight as double)

    End Function

    Is that the right way to set up this function. So if the user codes this, will the constant values show up for eTurns automatically ????

  5. #5
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: coding parameter constants ??

    Quote Originally Posted by DebbieInFlorida
    Is that the right way to set up this function. So if the user codes this, will the constant values show up for eTurns automatically ????
    They will indeed. Note that your function does not have a return type...do you mean it to be a subroutine instead? If so:

    VB Code:
    1. Private Enum eTurns
    2.     Turn_left_at_the_next_street = 0
    3.     Turn_left_after_the_next_street = 1
    4. End Enum
    5. Private Sub Whatever(eTurn As eTurns)
    6.  
    7. End Sub

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    193

    Re: coding parameter constants ??

    Thank you, and I will be returning something, I know how to take care of that. This solved my question, but is there a name for this type of setup???
    Thanks again everyone..

  7. #7
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: coding parameter constants ??

    sorry wasnt sure what u were looking for
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    193

    Re: coding parameter constants ??

    OK, How do I mark this resolved ???????

  9. #9
    Fanatic Member THEROB's Avatar
    Join Date
    Oct 2000
    Location
    I'm cold and there are wolves after me
    Posts
    575

    Re: coding parameter constants ??

    Click edit on your first post and change the title to have [Resolved] at the end - then you can rate everyone that helped
    My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]

  10. #10
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: coding parameter constants ??

    THEROB.. actually its easier now!
    above the first thread.. click the thread tools link,, pick Mark Resolved!
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

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