By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

how to get output from array element

P: 3
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




Expand|Select|Wrap|Line Numbers
  1. Partial Class dynamic_array
  2.     Inherits System.Web.UI.Page
  3.     Dim s(2) As String
  4.  
  5.     Dim str As String
  6.  
  7.  
  8.     Protected Sub btn_save_Click(sender As Object, e As System.EventArgs) Handles btn_save.Click
  9.  
  10.         Dim i As Integer = 0
  11.         For i = 0 To s.Length - 1
  12.             s(i) = InputBox("enter name " + (i + 1).ToString)
  13.         Next
  14.  
  15.  
  16.  
  17.     End Sub
  18.  
  19.     Protected Sub btn_get_Click(sender As Object, e As System.EventArgs) Handles btn_get.Click
  20.         Dim i As Integer = 0
  21.         str = ""
  22.  
  23.         For i = 0 To s.Length - 1
  24.             str &= s(i) + vbCrLf
  25.         Next
  26.  
  27.         MsgBox(str)
  28.  
  29.     End Sub
  30. End Class
Dec 12 '13 #1
Share this Question
Share on Google+
1 Reply


P: 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.
Dec 13 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.