Results 1 to 6 of 6

Thread: Optionboxes functions

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    The Netherlands
    Posts
    96

    Optionboxes functions

    I have a form full of Optionboxes...
    All the OptionBoxes are with two of them together...

    So I have for example:
    Dog or Cat
    Sheep or Cow
    Fish or Bird

    I want to write a function to return a 1 or a 0 to an integer...

    VB Code:
    1. Public Sub OneZero(One As Boolean, Zero As Boolean, intName As String)
    2. If One = True Then
    3.     Name = 1
    4. ElseIf Zero = True Then
    5.     Name = 0
    6. End If
    7. End Sub

    I call this functions...
    VB Code:
    1. call OneZero(optDog, optCat, "intDogCat")
    2. call OneZero(optCow, optSheep, "intSheepCow")
    3. call OneZero(optFish, optBird, "intFishBird")

    Problem now is I want the 1 or 0 into my intName instead of into Name...help!

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629


    Sorry, but I don't get it... could you please elaborate a bit ?
    -= a peet post =-

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    The Netherlands
    Posts
    96
    Mhh...
    Ok...

    I have 2 optionboxes for every pair...
    So I have optDog and optCat

    if optDog is selected I want to have a "1" into my intDogCat, if optCat is selected I want to have a "0" into my intDogCat

  4. #4
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    Public Sub OneZero(One As Boolean, Zero As Boolean, intName As Integer)
    If One = True Then
    intName = 1
    ElseIf Zero = True Then
    intName = 0
    End If
    End Sub


    call OneZero(optDog, optCat, intDogCat)
    call OneZero(optCow, optSheep, intSheepCow)
    call OneZero(optFish, optBird, intFishBird)



    try that
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    The Netherlands
    Posts
    96

    Nope...

    That doesn't work...

  6. #6
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    ??????? yes it does.... how are you doing it?

    VB Code:
    1. Private Sub Form_Load()
    2.     Dim optdog As Boolean
    3.     Dim optcat As Boolean
    4.     Dim intdogcat As Integer
    5.     optdog = False
    6.     optcat = True
    7.     Call OneZero(optdog, optcat, intdogcat)
    8.     MsgBox intdogcat
    9.    
    10. End Sub
    11. Public Sub OneZero(One As Boolean, Zero As Boolean, intName As Integer)
    12.     If One = True Then
    13.         intName = 1
    14.     ElseIf Zero = True Then
    15.         intName = 0
    16.     End If
    17. End Sub
    Remember, if someone's post was not helpful, you can always rate their post negatively .

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