I am trying to increment a number in my function, and i need the values updated in every tick
My Function is working in a timer
I tried this but it's giving me an error
Thank you for your help
The code i Tried:
My Public Class Form
Public Class Form1
Dim i0 As Integer = 0
Dim i1 As Integer = 0
Dim i2 As Integer = 0
Dim i3 As Integer = 0
Dim i4 As Integer = 0
Dim i5 As Integer = 0
Dim i6 As Integer = 0
Dim i7 As Integer = 0
Dim i8 As Integer = 0
Dim i9 As Integer = 0
Dim i10 As Integer = 0
My Function
Public Function IncrNum(ByRef i0 As Integer, ByRef i1 As Integer, ByRef i2 As Integer, ByRef i3 As Integer, ByRef i4 As Integer, ByRef i5 As Integer, ByRef i6 As Integer, ByRef i7 As Integer, ByRef i8 As Integer, ByRef i9 As Integer, ByRef i10 As Integer) As Integer
i0 = i0 + 1
If i0 = 100 Then i1 = i1 + 1 : i0 = 0
If i1 = 100 Then i2 = i2 + 1 : i1 = 0 : i0 = 0
If i2 = 100 Then i3 = i3 + 1 : i2 = 0 : i0 = 0 : i1 = 0
If i3 = 100 Then i4 = i4 + 1 : i3 = 0 : i0 = 0 : i1 = 0 : i2 = 0
If i4 = 100 Then i5 = i5 + 1 : i4 = 0 : i0 = 0 : i1 = 0 : i2 = 0 : i3 = 0
If i5 = 100 Then i6 = i6 + 1 : i5 = 0 : i0 = 0 : i1 = 0 : i2 = 0 : i3 = 0 : i4 = 0
If i6 = 100 Then i7 = i7 + 1 : i6 = 0 : i0 = 0 : i1 = 0 : i2 = 0 : i3 = 0 : i4 = 0 : i5 = 0
If i7 = 100 Then i8 = i8 + 1 : i7 = 0 : i0 = 0 : i1 = 0 : i2 = 0 : i3 = 0 : i4 = 0 : i5 = 0 : i6 = 0
If i8 = 100 Then i9 = i9 + 1 : i8 = 0 : i0 = 0 : i1 = 0 : i2 = 0 : i3 = 0 : i4 = 0 : i5 = 0 : i6 = 0 : i7 = 0
If i9 = 100 Then i10 = i10 + 1 : i9 = 0 : i0 = 0 : i1 = 0 : i2 = 0 : i3 = 0 : i4 = 0 : i5 = 0 : i6 = 0 : i7 = 0 : i8 = 0
If i10 = 100 Then i10 = 0 : i0 = 0 : i1 = 0 : i2 = 0 : i3 = 0 : i4 = 0 : i5 = 0 : i6 = 0 : i7 = 0 : i8 = 0 : i9 = 0
Return i0 i1 i2 i3 i4 i5 i6 i7 i8 i9 i10
End Function
Timer Tick
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
TextBox1.Text = RichTextBox1.Lines(i0) & RichTextBox1.Lines(i1) & RichTextBox1.Lines(i2) & RichTextBox1.Lines(i3) & RichTextBox1.Lines(i4) & RichTextBox1.Lines(i5) & RichTextBox1.Lines(i6) & RichTextBox1.Lines(i7) & RichTextBox1.Lines(i8) & RichTextBox1.Lines(i9) & RichTextBox1.Lines(i10)
IncrPost(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10)
End Sub
In every tick i want my TextBox1 update the Text
i11which you use without defining it), just don't return anything. You already pass your variables by reference anyway!