4
Contributors
4
Replies
41
Views
11 Months
Discussion Span
Last Post by Shark_1
0

This answer in array I want to answer in random please.

Dim NumOfIntegers() As Integer = {1, 2, 3, 4, 8}
        Dim x, y As Integer
        For Each num As Integer In NumOfIntegers
            x = num ^ 2
            y = num ^ 3
            MessageBox.Show("Square Of " & num & " = " & x & vbCrLf & "Cube Of " & num & " = " & y)
        Next
0

Your codes are quiet correct. To display as you desire you have to add string values through a loop to the label text property and do label's AutoSize property to False at design time or by code.

Label1.Text=Nothing
For Each num As Integer In NumOfIntegers
                   Label1.Text &= String.Format("Square Of {0} = {1}{2}Cube Of {0} = {3}{2}",num,num^2,vbcrlf,num^3)
Next

Edited by Shark_1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.