Results 1 to 6 of 6

Thread: Combo Box help

  1. #1

    Thread Starter
    Lively Member RedGunner's Avatar
    Join Date
    Oct 2008
    Location
    Ireland
    Posts
    67

    Exclamation Combo Box help

    Hey,

    I have two textboxes, basically its like a simple calculator

    I have + in the combo box but I can't work out how to make this work.

    Dim value1, value2, equals As Integer
    value1 = tbValue1.Text
    value2 = tbValue2.Text
    If cbOperator.SelectedItem = "+" Then
    lblEquals.Text = value1 + value2
    lblEquals.Text = "= " & equals
    End If

    What am I doing wrong? Thanks!!

  2. #2
    Addicted Member
    Join Date
    Dec 2006
    Location
    London, England
    Posts
    142

    Re: Combo Box help

    change to cbOperator.SelectedItem.tostring = "+"

    ToString returns a string value which will give you your true or false condition..

    using cbOperator.SelectedItem on its own, returns 2 values, {String}, +. A handy hint for testing strings, would be to set up something like

    dim mystring as String = cbOperator.SelectedItem to see the values been passed.

    Hope all this helps
    Redmo
    Last edited by redmo; Oct 30th, 2008 at 01:50 PM.
    The universal aptitude for ineptitude makes any human accomplishment an incredible miracle -Col. John P. Stapp


    Please rate the posts that have helped. Makes us feel all warm and fuzzy

  3. #3

    Thread Starter
    Lively Member RedGunner's Avatar
    Join Date
    Oct 2008
    Location
    Ireland
    Posts
    67

    Re: Combo Box help

    Hey,

    I did this but its just adding upto 0

    Dim value1, value2, equals As Integer
    value1 = tbValue1.Text
    value2 = tbValue2.Text
    If cbOperator.Text.ToString = "+" Then
    lblEquals.Text = value1 + value2
    lblEquals.Text = "= " & equals
    End If

    Any other ideas?

  4. #4
    Addicted Member
    Join Date
    Dec 2006
    Location
    London, England
    Posts
    142

    Re: Combo Box help

    you don't give equals a value.

    It should be given the answer to the sum

    Redmo
    The universal aptitude for ineptitude makes any human accomplishment an incredible miracle -Col. John P. Stapp


    Please rate the posts that have helped. Makes us feel all warm and fuzzy

  5. #5

    Thread Starter
    Lively Member RedGunner's Avatar
    Join Date
    Oct 2008
    Location
    Ireland
    Posts
    67

    Re: Combo Box help

    Ooops my mistake!! it works now!! Thank you very much!!

  6. #6
    Addicted Member
    Join Date
    Dec 2006
    Location
    London, England
    Posts
    142

    Re: Combo Box help

    Tá fáilte romhat

    Redmo
    The universal aptitude for ineptitude makes any human accomplishment an incredible miracle -Col. John P. Stapp


    Please rate the posts that have helped. Makes us feel all warm and fuzzy

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