I'm not sure if the solution is so easy as you write... VB(at least my 6 one) does not have the sum function... its necessary to write it at first. It could looks like this:

Public Function SUM(sNumber as String) As Integer
dim iX as integer, iCount as integer
for iX = 1 to len(sNumber)
iCount = iCount + CInt(Mid(sNumber, iX, 1))
Next iX
SUM = iCount
End Function

I'm not sure if the solution is so easy as you write... VB(at least my 6 one) does not have the sum function... its necessary to write it at first. It could looks like this:

Public Function SUM(sNumber as String) As Integer
dim iX as integer, iCount as integer
for iX = 1 to len(sNumber)
iCount = iCount + CInt(Mid(sNumber, iX, 1))
Next iX
SUM = iCount
End Function

Lets make sure of our definitions first... The sum of numbers is, those numbers being added together, while the product of numbers is, those numbers being multiplied together. So if you want the sum of numbers in a string then celt.max's code does work...

Option Explicit
Private Sub Form_Load()
Dim Result As Integer
Result = SUM("1234")
MsgBox Result
End Sub
Public Function SUM(sNumber As String) As Integer
Dim iX As Integer, iCount As Integer
For iX = 1 To Len(sNumber)
iCount = iCount + CInt(Mid(sNumber, iX, 1))
Next iX
SUM = iCount
End Function

However, if you are wanting the product of the numbers, then yes a different solution is needed. So, are you wanting the product of these numbers?

Private Sub Command1_Click()
On Error GoTo Errorhandler
x = InputBox("Please Enter an Integer.", , Text1.Text)
If x <> "" Then
List1.AddItem Str(x)
Do While x <> 1
If x Mod 2 = 0 Then
x = x / 2
Else
x = (x * 3) + 1
End If
List1.AddItem Str(x)
Loop
'Number of steps used
Label1 = List1.ListCount - 1
End If
Errorhandler:
Exit Sub
End Sub
'Even numbers are divided by 2
'Odd numbers are multiplied by 3 and are then increased by 1
'The problem ends by reaching the number 1

package grossmontbank;
import java.util.Scanner;
public class GrossmontBank
{
//class variables (global - accessible throughout this class)
//scanner object to be used throughout
private static Scanner input = new Scanner(System.in);
//array ...