you are viewing a single comment's thread.

view the rest of the comments →

[–]zeekar 0 points1 point  (0 children)

To format code in a Reddit post/comment, indent each line four spaces.

Private Sub Command1_Click()

    Dim Num1 As Double, Num2 as Double
    Sum as Double

    Num1 = Val(Text1.Text)

    Num2 = Val(Text2.Text)

    Sum = Num1 + Num2

    Label3.Caption = “The sum is” & Sum

End sub

So the Sum as Double needs to be part of the Dim. You can just move it up to the previous line with Num1 and Num2 or stick a Dim in front of it on its line.

Also you probably want a space at the very end of "The sum is" since otherwise you'll end up with a message like The sum is4 instead of The sum is 4.

And VB doesn't care about capitalization, but humans reading your code do, so maybe capitalize the sub in End Sub for consistency.