Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42225

Passing parameters using

$
0
0
Does anyone know how to pass parameter from one procedure to another via an event such as a button click rather than using a CALL statement?

Procedure 1 fills a 6 element array with random numbers.
Procedure 2 display 1st element in a text box when button is clicked
Procedure 3 display 2nd element in a text box when another button is clicked
etc


Public Class Form1

Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
lstDisplay.Items.Clear()
Dim Cam(5) As Integer
Dim lottery As Integer
Dim counter As Integer
Dim unique As Boolean
Dim index As Integer

For counter = 0 To 5


Do
lottery = Int((49 * Rnd()) + 1)
unique = False
For index = 0 To 5
If Cam(index) = lottery Then
unique = True


End If
Next
Loop Until (unique = False)
Cam(counter) = lottery

lstDisplay.Items.Add(Cam(counter))
Next
TxtNumber1.Text = Cam(0)
TxtNumber2.Text = Cam(1)
TxtNumber3.Text = Cam(2)
TxtNumber4.Text = Cam(3)
TxtNumber5.Text = Cam(4)
TxtNumber6.Text = Cam(5)
End Sub

Private Sub cmdBall1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBall1.Click
Would like this TxtNumber1.Text = Cam(0) here
End Sub

Private Sub cmdBall2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBall2.Click

End Sub

Private Sub cmdBall3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBall3.Click

End Sub

Private Sub cmdBall4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBall4.Click

End Sub

Private Sub cmdBall5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBall5.Click

End Sub

Private Sub cmdBall6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBall6.Click

End Sub
End Class

Viewing all articles
Browse latest Browse all 42225


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>