[Help] text1 + label1

Discussion in 'Programming General' started by leder678, Apr 16, 2008.

[Help] text1 + label1
  1. Unread #1 - Apr 16, 2008 at 12:52 PM
  2. leder678
    Joined:
    Jan 4, 2008
    Posts:
    4
    Referrals:
    0
    Sythe Gold:
    0

    leder678 Newcomer

    [Help] text1 + label1

    I have a code, were if i click on a command button, the result should be

    text1 + label1 = 150

    but it become text1 + label1 = 10050

    here are the code

    Code:
    Private Sub Command1_Click()
    Text1 = Text1.Text + Label1.Caption
    End Sub
    *NB!: i have tested text1.text + label1.caption etc.
     
  3. Unread #2 - Apr 16, 2008 at 1:10 PM
  4. Flaming Idiots
    Joined:
    Dec 22, 2005
    Posts:
    235
    Referrals:
    1
    Sythe Gold:
    0
    Two Factor Authentication User

    Flaming Idiots Active Member
    Visual Basic Programmers

    [Help] text1 + label1

    The problem is because you are adding 2 strings together. You need to convert them to numbers first.
    Code:
     Text1 = CDbl(Text1.Text) + CDbl(Label1.Caption)
     
  5. Unread #3 - Apr 16, 2008 at 1:37 PM
  6. leder678
    Joined:
    Jan 4, 2008
    Posts:
    4
    Referrals:
    0
    Sythe Gold:
    0

    leder678 Newcomer

    [Help] text1 + label1

    Thank you VERY much, it worked
     
  7. Unread #4 - Apr 16, 2008 at 4:00 PM
  8. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    [Help] text1 + label1

    You should always define the property of the output area as well, it just makes things more neat. So instead of Text1 = , you'd have Text1.Text = .
     
< Reading seperate lines of a txt, silent typing, selecting textboxes in a browser... | persistence? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site