# [RESOLVED] How to calculate the total sum of the numbers

Show 50 post(s) from this thread on one page
Page 2 of 2 First 12
• October 5th, 2012, 02:09 PM
jggtz
Re: [RESOLVED] How to calculate the total sum of the numbers
The character _ means continuation line... just press Enter after _ and continue typing next line of code
• October 5th, 2012, 04:19 PM
Halosar7
Re: [RESOLVED] How to calculate the total sum of the numbers
I have another question for you.

For each 8 textbox i can enter any number i want.(from 0 to 9)
But how to do that on each textbox i can enter specific number? For example:

Attachment 30427

And i notice a mistake, look at this picture.

Attachment 30429

My C-button clear all textbox and leave them blank.

My code is this:

Code:

```  Dim intTotal1 As Integer Dim strTotal1 As String Dim intTotal2 As Integer Private Sub Command1_Click()   If IsNumeric(Text1.Text) And _       IsNumeric(Text2.Text) And _       IsNumeric(Text3.Text) And _       IsNumeric(Text4.Text) And _       IsNumeric(Text5.Text) And _       IsNumeric(Text6.Text) And _       IsNumeric(Text7.Text) And _       IsNumeric(Text8.Text) Then         intTotal1 = Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text) + Val(Text7.Text) + Val(Text8.Text)         strTotal1 = Format(intTotal1, "00")         intTotal2 = Val(Left(strTotal1, 1)) + Val(Right(strTotal1, 1))         Label1.Caption = Format(intTotal2)     Else       MsgBox "Laukelis paliktas tuščias arba įvestas ne skaičius!", vbInformation, "Dėmesio!"         End If End Sub Private Sub Command2_Click() Dim Contrl As Control For Each Contrl In Form1.Controls If (TypeOf Contrl Is TextBox) Then Contrl.Text = "" End Sub```
• October 5th, 2012, 08:14 PM
jggtz
Re: [RESOLVED] How to calculate the total sum of the numbers
Code:

```Dim intTotal1 As Integer Dim strTotal1 As String Dim intTotal2 As Integer Dim strTotal2 As String Private Sub Command1_Click()   If IsNumeric(Text1.Text) And _       IsNumeric(Text2.Text) And _       IsNumeric(Text3.Text) And _       IsNumeric(Text4.Text) And _       IsNumeric(Text5.Text) And _       IsNumeric(Text6.Text) And _       IsNumeric(Text7.Text) And _       IsNumeric(Text8.Text) Then         If Val(Text1.Text) <> 1 And Val(Text1.Text) <> 2 Then             MsgBox "Year must begin with 1 or 2"             Exit Sub         End If         If Val(Text5.Text & Text6.Text) < 1 Or _           Val(Text5.Text & Text6.Text) > 12 Then             MsgBox "Month must be between 01 and 12"             Exit Sub         End If         If Val(Text7.Text & Text8.Text) < 1 Or _           Val(Text7.Text & Text8.Text) > 31 Then             MsgBox "Day must be between 01 and 31"             Exit Sub         End If         intTotal1 = Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text) + Val(Text7.Text) + Val(Text8.Text)         strTotal1 = Format(intTotal1, "00")         intTotal2 = Val(Left(strTotal1, 1)) + Val(Right(strTotal1, 1))         If intTotal2 > 9 Then             strTotal2 = Format(intTotal2, "00")             intTotal2 = Val(Left(strTotal2, 1)) + Val(Right(strTotal2, 1))                End If         Label1.Caption = Format(intTotal2)     Else       MsgBox "Laukelis paliktas tuščias arba įvestas ne skaičius!", vbInformation, "Dėmesio!"     End If End Sub Private Sub Command2_Click()     Dim Contrl As Control     For Each Contrl In Form1.Controls         If (TypeOf Contrl Is TextBox) Then             Contrl.Text = ""         End If     Next End Sub```
• October 5th, 2012, 11:24 PM
dglienna
Re: [RESOLVED] How to calculate the total sum of the numbers
add another line of code. that's what _ means
• October 6th, 2012, 01:45 AM
Halosar7
Re: [RESOLVED] How to calculate the total sum of the numbers
Quote:

Originally Posted by dglienna
add another line of code. that's what _ means

It means that we continue programing by fixing bug and i ask him about vb6 programing. That way i learning from his code.
• October 6th, 2012, 05:51 PM
jggtz
Re: [RESOLVED] How to calculate the total sum of the numbers
Iy would be better if you start a new thread about transparency in VB6... anyway
Here's a small VB6 project about transparent form
I think this is better than explain here
• October 6th, 2012, 06:01 PM
Halosar7
Re: [RESOLVED] How to calculate the total sum of the numbers
Quote:

Originally Posted by jggtz
Iy would be better if you start a new thread about transparency in VB6... anyway
Here's a small VB6 project about transparent form
I think this is better than explain here

Thanks :-)
Show 50 post(s) from this thread on one page
Page 2 of 2 First 12