|
-
Apr 3rd, 2000, 06:57 PM
#1
Thread Starter
Lively Member
Hi,
I use the following code to load random numbers, from -12 to +12, into
an array of text boxes when my form loads. 0 is excluded - it never loads into a textbox.
Private Sub Form_Load()
Dim iCounter As Integer
For iCounter = 0 To 7
Text1(iCounter) = 0
Randomize
Do Until Text1(iCounter) <> 0
Text1(iCounter) = Int((23 * Rnd) - 10)
Loop
Next
End Sub
I've been trying for ages to adjust it a little bit. For numbers greater than 0 I want the "+" character to appear before those numbers. E.g: instead of "2" in a text box, it will be "+2".
I tried things like:
Do Until Text1(iCounter) <> 0
If Text1(iCounter) > 0 Then
Text1(iCounter) = "+" & Int((23 * Rnd) - 10)
Loop
Next
but had no luck. Any ideas?
Thanks.
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
|