hi am new here and in vb.net
and i've been trying to display outputs form an array but the message box appears empty with nothing in it ..
here is the code :

Dim r As Random = New Random()



For i = 1 To dept_no


For j = 0 To dept(i).GetUpperBound(0) - 1

dept(i)(j) = r.Next(300, 1000)
output &= dept(i)(j) & " "


Next
output &= vbCrLf


Next
MessageBox.Show("salaries are" & vbTab & output)

Try this.

Dim r As Random = New Random()
        Dim dept_no As Integer = 3
        Dim dept(3)() As Integer
        Dim i, j As Integer
        Dim output As String = String.Empty


        For i = 0 To dept_no
            ReDim dept(i)(8)
            For j = 0 To dept(i).GetUpperBound(0)  
                dept(i)(j) = r.Next(300, 1000)
                output &= dept(i)(j) & " "
            Next
            output &= vbCrLf
        Next
        MessageBox.Show("salaries are" & vbTab & output)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.