SiteMap  | About    


Arrays are using for store similar data types grouping as a single unit. We can access Array elements by its numeric index. The array indexes start at zero.

The default value of numeric array elements are set to zero, and reference elements are set to null .
  Dim arr(6) As String
  arr(0) = "Sunday"

arr(1) = "Monday"

  string[] arr = new string[7];
  arr[0] = "Sunday";

arr[1] = "Monday";

The abovecode declare a string array of 7 strings and assign some values to it.

We can access the Arrays elements by providing its numerical index.

  Dim str As String = arr(1)


  string str = arr[1];

Above statement returns the second value from the Array.

The following ASP.NET program fill an arra with seven days in a week and bind it to a ListBox control.



<html xmlns="">
<head id="Head1" runat="server">
	<title>Untitled Page</title>
	<form id="form1" runat="server">
		<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
		<br />
		<asp:ListBox ID="ListBox1" runat="server"></asp:ListBox><br />

Click the following links to see full source code

C# Source Code
VB.NET Source Code
Default.aspx.vb (C) 2018    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.