Help!!! Summations

duj3e

New member
Joined
May 10, 2006
Messages
3
Programming Experience
Beginner
I am new to programing and i would like to aks if somebody know the code how to do sumations in vb?
tnx
 
Summations..... Mmmmm

  1. The act or process of adding; addition.
  2. A sum or aggregate.
  3. A concluding part of a speech or argument containing a summary of principal points, especially of a case before a court of law.
  4. Physiology. The process by which multiple or repeated stimuli can produce a response in a nerve, muscle, or other part that one stimulus alone cannot produce.
First of all which one (by the way if it's one of latter two then your on the wrong forum)
Second of all, i think we'd need to see a bit of a clear explanation and maybe some code.
 
a summation like: 1+2=3 but in vb writes 12 not 3
i just need the code for that something like "dimA as integer" i think is,
i use vb 6.0, tnx
 
If you use the addition operator with strings then it will concatenate them. If you use it with numbers it will sum them. If you want to add numbers then use numbers, not strings.
VB.NET:
Dim s1 As String = "1"
Dim s2 As String = "2"
Dim s3 as String = s1 + s2 's3 contains the string "12".

Dim i1 As Integer = 1
Dim i2 As Integer = 2
Dim i3 as Integer = i1 + i2 'i3 contains the number 3.
 
help with calculations again!!! (posted code)

this is the code and the operation a got to do and the names of the variables(inputed as integers), but i did something wrong i dont know whot plz help

Private Sub BO_Click()
Dim W As Integer
Dim L As Integer
Dim D As Integer
G = W + L + D
p = W + L
sc = 1000 - 4 * L + 8 * W + G / 10 - D
End Sub


this is when someone enter the first 3 variable in the textbox(W, L, D) to calculate as shown in the code and output it int the textbox (G, p, sc)
plz help me
 
duj3e said:
i use vb 6.0
These forums are for VB.Net, which you are more than welcome to step up to, but if you decide to stick with VB6 you'll have to find other forums to ask about that language.
Btw, your calculations above always results zero.
 
duj3e, you asked me why the result is always 0, I think the answer also serves here in the open:
Because you create new integer variables W,L,D which initialize to 0, and don't set other value later. When you know W,L,D is 0, you can easily see that the result of the calculation is always 0. You probably want to set those variables to something based on user input. This is so extremely basic programming knowledge (usually one of the first things taught to beginners), that the best advice is for you to spend a few hours reading a beginners book or some online tutorials. You will get far more out of that than asking questions of this level at internet forums.
 
Back
Top