|
-
Oct 29th, 2010, 03:55 PM
#1
Thread Starter
New Member
Annoying Zero VB 2010
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
===============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
-
Oct 29th, 2010, 04:11 PM
#2
Re: Annoying Zero VB 2010
You posted in the wrong section. this is for VB Classic not .Net. I've notified Mods to move the thread for you.
-
Oct 29th, 2010, 04:15 PM
#3
Thread Starter
New Member
Re: Annoying Zero VB 2010
thank you, I already post it in vb.net, thank you for advising me.
-
Oct 29th, 2010, 04:27 PM
#4
Re: Annoying Zero VB 2010
Your problem is that you are first adding items to the listbox and then doing the calculations. It should be the other way around.
-
Oct 29th, 2010, 04:42 PM
#5
Thread Starter
New Member
Re: Annoying Zero VB 2010
can you post the code, is my first program in visual basic and I thing this is as far as I can go, it would be of great help. thank you.
-
Oct 29th, 2010, 04:43 PM
#6
Re: Annoying Zero VB 2010
Move the .Add functions to the end of the loop.
-
Oct 29th, 2010, 04:51 PM
#7
Thread Starter
New Member
Re: Annoying Zero VB 2010
like this
Do Until tCounter >= 13
'operacion con counter
tMulti = tCounter * numeroMulti
tSuma = tCounter + numeroSuma
tCounter = tCounter + 1
ListBox1.Items.Add(numeroMulti & "X" & tCounter & "=" & "" & tMulti) 'lista resultado multiplicacion
ListBox2.Items.Add(numeroSuma & "+" & tCounter & "=" & "" & tSuma) 'lista resultado suma
Loop
is still showing the extra zero in the result, man I'm done, is too hard.
-
Oct 29th, 2010, 04:56 PM
#8
Re: Annoying Zero VB 2010
Try
Code:
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
-
Oct 29th, 2010, 05:05 PM
#9
Thread Starter
New Member
Re: Annoying Zero VB 2010
jajajajaj, Thanks baja_yu it work, you are amazing, my first program an is running great thank to you, thank, thank, thank, thank, thank for your help, I appreciate it a lot.
THANKS!!!!!!!!!!!!!!!!.
-
Oct 29th, 2010, 05:31 PM
#10
Re: Annoying Zero VB 2010
No problem.
As you feel your question has been answered, please take time to mark the thread as Resolved. You can do so by going to the Thread Tools menu, which is on the right side above your original post, and choosing Mark Thread Resolved.
-
Oct 29th, 2010, 09:00 PM
#11
Re: Annoying Zero VB 2010
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|