|
-
Aug 15th, 2006, 03:33 PM
#10
Thread Starter
Lively Member
Re: Getting the middle number
I used this code but nothing happens:
Private Function GetMiddleNumber(sNum As String) As Long
sNum = CStr(Val(txtKeyValue(0).Text))
If Len(sNum) Mod 2 = 0 Then
GetMiddleNumber = CLng(Mid(sNum, Len(sNum) / 2, 2))
Else
GetMiddleNumber = CLng(Mid(sNum, Len(sNum) / 2, 3))
End If
End Function
Private Sub cmdCompute_Click()
y = Val(txtLKeyValue.Text) - 1
For x = 0 To y
w = Len(txtKeyValue(x).Text)
If w <> Val(txtSKeyValue.Text) Then
MsgBox "Incorrect input"
txtKeyValue(x).SetFocus
Else
lblAnswer(0).Caption = GetMiddleNumber("123456789") ^ 2
End If
Next
End Sub
To become a PROFESSIONAL,
Start from SCRATCH... 
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
|