how to get output from array element

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hrutu
    New Member
    • Dec 2013
    • 3

    how to get output from array element

    In this program i created one array, while clicking on the get button it does not show the any output because the str variable is empty, how should i get proper output... Please help me




    Code:
    Partial Class dynamic_array
        Inherits System.Web.UI.Page
        Dim s(2) As String
    
        Dim str As String
    
    
        Protected Sub btn_save_Click(sender As Object, e As System.EventArgs) Handles btn_save.Click
    
            Dim i As Integer = 0
            For i = 0 To s.Length - 1
                s(i) = InputBox("enter name " + (i + 1).ToString)
            Next
    
    
    
        End Sub
    
        Protected Sub btn_get_Click(sender As Object, e As System.EventArgs) Handles btn_get.Click
            Dim i As Integer = 0
            str = ""
    
            For i = 0 To s.Length - 1
                str &= s(i) + vbCrLf
            Next
    
            MsgBox(str)
    
        End Sub
    End Class
    Last edited by zmbd; Dec 13 '13, 06:06 PM. Reason: [Rabbit; Please use [CODE] and [/CODE] tags when posting code or formatted data.] [Z{Please do not YELL, changed post to proper sentence case - easier on the eyes!}]
  • Fluke
    New Member
    • Dec 2013
    • 2

    #2
    Use breakpoints to halt the program so you can hover the mouse over a given variable to examine its contents. This will help you see the difference between your assumptions and the reality of what your code does.

    Comment

    Working...