Thread: Array
View Single Post
Old Apr 23rd, 2008, 11:36 AM   #1
A.K.Al Shamsi
Programmer
 
A.K.Al Shamsi's Avatar
 
Join Date: Mar 2008
Posts: 35
Rep Power: 0 A.K.Al Shamsi is on a distinguished road
Array

hi there.... how are you guys??

could somebody help to correct my code??? i have a problem for displaying arrays in the list box


here is the code


Public Class Form1

    Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
        ErrorProvider1.Clear()

        Dim total As Decimal
        Dim sales As Decimal
        Dim flag As Boolean

        flag = False

        sales = Val(txtSales.Text)
        total = 200 + (0.09 * sales)
        txtSalary.Text = total.ToString

        If (txtSales.Text = "") Then
            ErrorProvider1.SetError(txtSales, "You shoulde enter the sales")
            flag = True
            txtSalary.Text = ""
        End If
    End Sub

    Private Sub btnTotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTotal.Click
        Dim salary As Integer
        Dim survey(0 To 8) As Integer

        ListBox1.Items.Add("Salary Range:" + "        " + "Total:")
        ListBox1.Items.Add(salary.ToString)


        Select Case salary
            Case 200 To 299
                survey(0) += 1
            Case 300 To 399
                survey(1) += 1
            Case 400 To 499
                survey(2) += 1
            Case 500 To 599
                survey(3) += 1
            Case 600 To 699
                survey(4) += 1
            Case 700 To 799
                survey(5) += 1
            Case 800 To 899
                survey(6) += 1
            Case 900 To 999
                survey(7) += 1
            Case Is > 100
                survey(8) += 1
        End Select


    End Sub
End Class


and this is what it shows




how can i display all of them??
A.K.Al Shamsi is offline   Reply With Quote