this is my problem here i want to increase index of global array to return different values.
but every time i click on button it resets to old value.
here is my code....
Public Class Form1
Inherits System.Windows.Forms.Form
Dim a(5) As Decimal
Dim i As Integer
Dim j As Integer=0
Private Sub btnCalculate_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnCalculate.Click
For i = j To j
Dim dOrderTotal As Decimal
Dim dDiscountPct As Decimal
Dim dDiscountAmount As Decimal
Dim dInvoiceTotal As Decimal
dOrderTotal = txtOrderTotal.Text
If dOrderTotal >= 100 Then
dDiscountPct = 0.2
Else
dDiscountPct = 0
End If
dDiscountAmount = dOrderTotal * dDiscountPct
dInvoiceTotal = dOrderTotal - dDiscountAmount
lblDiscountAmount.Text = dDiscountAmount
lblInvoiceTotal.Text = dInvoiceTotal
txtOrderTotal.Focus()
a(i) = dInvoiceTotal
Next
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnExit.Click
MessageBox.Show(a(0) & ControlChars.CrLf & a(1) & ControlChars.CrLf & a(2)& ControlChars.CrLf & a(3) & ControlChars.CrLf & a(4))
Me.Close()
End Sub
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub[![enter image description here][1]][1]