Results 1 to 2 of 2

Thread: Anoying Zero Impossible to resolve, can you?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2010
    Posts
    11

    Unhappy Anoying Zero Impossible to resolve, can you?

    Thank you all for your help:

    My program is running great with one little problem, it keep adding a zero to my listbox and the multiplication and sum result don't line up well. Heeeeelp. the result would be like:

    1X0 = 0 <==== The Problem
    1X1 = 0
    1X2 = 1
    1X3 = 2

    please post the code is my first vb project and my head hurt trying to resolve this problem.
    ===============new code===============================


    Dim numeroMulti, numeroSuma As Integer

    'data enter by user
    numeroMulti = CDbl(TextBox1.Text)
    numeroSuma = CDbl(TextBox1.Text)


    'line of code to call modul tmultiSuma
    Call tmultiSuma(numeroMulti, numeroSuma)

    End Sub
    Public Sub tmultiSuma(ByVal numeroMulti As Integer, ByVal numeroSuma As Integer)
    Dim tMulti, tSuma, tCounter As Integer

    'loop to calculat sum and multiplication table

    Do Until tCounter = 13
    'lista resultado multiplicacion
    ListBox1.Items.Add(tCounter & "X" & numeroMulti & "=" & "" & tMulti)

    'lista resultado suma
    ListBox2.Items.Add(tCounter & "+" & numeroSuma & "=" & "" & tSuma)

    'operation with a counter
    tMulti = tCounter * numeroMulti
    tSuma = tCounter + numeroSuma
    tCounter = tCounter + 1
    Loop
    Last edited by thewhiteshadow; Oct 29th, 2010 at 05:09 PM.

  2. #2

    Thread Starter
    New Member
    Join Date
    Oct 2010
    Posts
    11

    Re: Impossible to resolve, can you?

    PROBLEM RESOLVE THANK TO BAJA_YU
    here is the code to make it work if some newbee like me get the same or similar proble.

    Do Until tCounter >= 13
    tCounter = tCounter + 1

    'operacion con counter
    tMulti = tCounter * numeroMulti
    tSuma = tCounter + numeroSuma

    ListBox1.Items.Add(numeroMulti & "X" & tCounter & "=" & "" & tMulti) 'lista resultado multiplicacion
    ListBox2.Items.Add(numeroSuma & "+" & tCounter & "=" & "" & tSuma) 'lista resultado suma
    Loop

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