<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns=3D"http://www.w3.org/TR/REC-html40" xmlns:v =3D
"urn:schemas-microsoft-com:vml" xmlns:o =3D
"urn:schemas-microsoft-com:office:office" xmlns:w =3D
"urn:schemas-microsoft-com:office:word" xmlns:st1 =3D
"urn:schemas-microsoft-com:office:smarttags"><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2900.2523" name=3DGENERATOR><o:SmartTagType
name=3D"country-region"
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType=
><o:SmartTagType
name=3D"Street"
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType=
><o:SmartTagType
name=3D"address"
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType=
><o:SmartTagType
name=3D"PlaceType"
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType=
><o:SmartTagType
name=3D"PlaceName"
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType=
><o:SmartTagType
name=3D"place"
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType=
><!--[if !mso]>
<STYLE>st1\:* {
        BEHAVIOR: url(#default#ieooui)
}
</STYLE>
<![endif]-->
<STYLE>@font-face {
        font-family: SimSun;
}
@font-face {
        font-family: @SimSun;
}
@page {mso-endnote-separator: url("cid:header.htm\@01C7B4B4.7CE9D280") es;=
mso-endnote-continuation-separator: url("cid:header.htm\@01C7B4B4.7CE9D280"=
) ecs; }
@page Section1 {size: 595.3pt 841.9pt; margin: 2.0cm 2.0cm 2.0cm 2.0cm; mso-=
footer: url("cid:header.htm\@01C7B4B4.7CE9D280") f1; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
P.MsoHeader {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoHeader {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoHeader {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
P.MsoFooter {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoFooter {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoFooter {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle19 {
        COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: personal-compose
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=3DEN-AU vLink=3Dpurple link=3Dblue>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D093342201-25062007><FONT face=3DAr=
ial
color=3D#0000ff size=3D2>Hi Bruce,</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D093342201-25062007> &nb=
sp; <FONT
face=3DArial color=3D#0000ff size=3D2>Does this help? <BR>taken from <A
href=3D"http://www.ondotnet.com/pub/a/dotnet/excerpt/vbnetnut_appa/index.htm=
l?page=3D2">http://www.ondotnet.com/pub/a/dotnet/excerpt/vbnetnut_appa/index=
.html?page=3D2</A></FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D093342201-25062007><FONT face=3DAr=
ial
color=3D#0000ff size=3D2>
<DIV align=3Dleft>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN
style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Cheers<o:p></o:p>=
</SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN
style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Damien
Atkinson-Buck<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><SPAN
style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">IT
Department<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 0pt"><st1:place
w:st=3D"on"><st1:PlaceName w:st=3D"on"><SPAN
style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Keilor</SPAN></st=
1:PlaceName><SPAN
style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> <st1:PlaceName
w:st=3D"on">Downs</st1:PlaceName> <st1:PlaceType
w:st=3D"on">College</st1:PlaceType></SPAN></st1:place><SPAN
style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p></o:p></SPAN=
></P></DIV></FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D093342201-25062007>
<H4><A name=3Darray_declar>Arrays and array declarations</A></H4>
<P>VB 6 permitted you to define the lower bound of a specific array, as well=
as
the default lower bound of arrays whose lower bound was not explicitly
specified. In VB .NET, the lower bound of every array dimension is 0 and can=
not
be changed. The following examples show how to declare a one-dimensional arr=
ay,
with or without an explicit size and with or without initialization:</P><PRE=
><CODE><FONT color=3D#003366>' Implicit constructor: No initial size and no=
initialization
Dim Days( ) As Integer
<FONT color=3D#ff0000><STRONG>' Explicit constructor: No initial size and no=
initialization
Dim Days( ) As Integer =3D New Integer( ) {}</STRONG></FONT>
<FONT color=3D#000000>' Implicit constructor: Initial size but no initializa=
tion
Dim Days(6) As Integer</FONT>
' Explicit constructor: Initial size but no initialization
Dim Days( ) As Integer =3D New Integer(6) {}
' Implicit constructor: Initial size implied by initialization
Dim Days( ) As Integer =3D {1, 2, 3, 4, 5, 6, 7}
' Explicit constructor, Initial size and initialization
Dim Days( ) As Integer =3D New Integer(6) {1, 2, 3, 4, 5, 6, 7}</FONT></COD=
E></PRE>
<P>Note that in the declaration:</P><PRE><CODE><FONT color=3D#003366>Dim Arr=
ayName(X) As ArrayType</FONT></CODE></PRE>
<P>the number X is the upper bound of the array. Thus, the array has size
X+1.</P>
<P>Multidimensional arrays are declared similarly. For instance, the followi=
ng
example declares and initializes a two-dimensional array:</P><PRE><CODE><FON=
T color=3D#003366>Dim X(,) As Integer =3D {{1, 2, 3}, {4, 5, 6}}</FONT></COD=
E></PRE>
<P>and the following code displays the contents of the array:</P><PRE><CODE>=
<FONT color=3D#003366>Debug.Write(X(0, 0))
Debug.Write(X(0, 1))
Debug.Writeline(X(0, 2))
Debug.Write(X(1, 0))
Debug.Write(X(1, 1))
Debug.Write(X(1, 2))
123
456</FONT></CODE></PRE>
<P>In VB .NET, all arrays are dynamic; there is no such thing as a fixed-siz=
e
array. The declared size should be thought of simply as the initial size of=
the
array, which is subject to change using the <CODE><FONT
color=3D#003366>ReDim</FONT></CODE> statement. Note, however, that the numbe=
r of
dimensions of an array cannot be changed.</P>
<P>Moreover, unlike VB 6, the <CODE><FONT color=3D#003366>ReDim</FONT></CODE=
>
statement cannot be used for array declaration, but only for array resizing.=
All
arrays must be declared initially using a <CODE><FONT
color=3D#003366>Dim</FONT></CODE> (or equivalent) statement.</P></SPAN></DIV=
><BR>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> sofdev-bounces@edulists.com.au
[mailto:sofdev-bounces@edulists.com.au] <B>On Behalf Of </B>RILEY,
Bruce<BR><B>Sent:</B> Friday, 22 June 2007 10:03 AM<BR><B>To:</B> Year 12
Software Development Teachers' Mailing List<BR><B>Subject:</B> [Year 12 SofD=
ev]
Arrays of unknown length.<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=3DSection1>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hi all<o:p></o:p></SPAN></FONT=
></P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">I am trying to work out how a=
example of using a 1-d array of unknown length to demo to the students. I am=
using VB .NET<o:p></o:p></SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT=
></P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Essentially I want to input an=
unknown number of integers using an inputbox, enter a piece of dummy data to=
end
the input, then display these back to the students.<o:p></o:p></SPAN></FONT>=
</P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT=
></P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">I am trying to use eg. Dim Sco=
re()
as integer and then later use ReDim Preserve(count) but can’t get the=
code
right. <o:p></o:p></SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT=
></P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Any help would be gratefully
received.<o:p></o:p></SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT=
></P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">------------------------------=
------------------------------------------------------</SPAN></FONT><o:p></o=
:p></P>
<P class=3DMsoNormal><FONT face=3D"Times New Roman" size=3D3><SPAN
style=3D"FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Bruce
Riley</SPAN></FONT><o:p></o:p></P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">ICT
Manager</SPAN></FONT><o:p></o:p></P>
<P class=3DMsoNormal><st1:place w:st=3D"on"><st1:PlaceName w:st=3D"on"><FONT=
face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Kew</SPAN></FONT></st1:PlaceNa=
me><FONT
face=3DArial size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">
<st1:PlaceType w:st=3D"on">High
School</st1:PlaceType></SPAN></FONT></st1:place><o:p></o:p></P>
<P class=3DMsoNormal><st1:Street w:st=3D"on"><st1:address w:st=3D"on"><FONT=
face=3DArial
size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">1393 Burke
Road</SPAN></FONT></st1:address></st1:Street><o:p></o:p></P>
<P class=3DMsoNormal><st1:place w:st=3D"on"><FONT face=3DArial size=3D2><SPA=
N
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Kew</SPAN></FONT></st1:place><=
FONT
face=3DArial size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial"> E=
ast, VIC.
3102</SPAN></FONT><o:p></o:p></P>
<P class=3DMsoNormal><st1:country-region w:st=3D"on"><st1:place w:st=3D"on">=
<FONT
face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Australia</SPAN></FONT></st1:p=
lace></st1:country-region><o:p></o:p></P>
<P class=3DMsoNormal><FONT face=3D"Times New Roman" size=3D3><SPAN
style=3D"FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Phone: 61 3 9859
8652</SPAN></FONT><o:p></o:p></P>
<P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Fax: 6=
1 3
9819 7880</SPAN></FONT><o:p></o:p></P>
<P class=3DMsoNormal><FONT face=3D"Times New Roman" size=3D3><SPAN
style=3D"FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P></DIV>_________=
______________________________________
<BR><A href=3D"http://www.edulists.com.au">http://www.edulists.com.au </A>IT=
Software Development Mailing List kindly supported by <BR><A
href=3D"http://www.vcaa.vic.edu.au">http://www.vcaa.vic.edu.au </A>- Victori=
an
Curriculum and Assessment Authority and <BR><A
href=3D"http://www.vitta.org.au">http://www.vitta.org.au </A>- VITTA Victori=
an
Information Technology Teachers Association Inc <p></p><p><b>Important - </b=
>This email and any attachments may be confidential. If received in error, p=
lease contact us and delete all copies. Before opening or using attachments=
check them for viruses and defects. Regardless of any loss, damage or conse=
quence, whether caused by the negligence of the sender or not, resulting dir=
ectly or indirectly from the use of any attached files our liability is limi=
ted to resupplying any affected attachments. Any representations or opinions=
expressed are those of the individual sender, and not necessarily those of=
the Department of Education.</p></BODY></HTML>