I believe you may find it advantageous to use named constants for the
variables in the array ... it can make identifying different elements easier
when reading the code. And get into the habit of using 0-based arrays -- a
suggestion.
For example ...
private const nStudentName = 0
private const nMark1 = 1
private const nMark2 =2
private const nMark3 = 3
Dim Details(0 To 19, 0 To 3) As String '20 x 4
Details(Index, nStudentName ) = txtName.Text
Details(Index, nMark1) = txtMark1.Text
Details(Index, nMark2) = txtMark2.Text
Details(Index, nMark3) = txtMark3.Text
--
Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Roy Riddex" <ro**************@blueyonder.co.uk> wrote in message
news:Zf*****************@news-binary.blueyonder.co.uk...
: I've just moved onto 2-D Arrays in my VB6 beginners book. I'm struggling
to
: get my head around the following problem but no doubt you will think it
: rather easy.
: My program is supposed to allow up to 20 students to enter their name and
3
: exam marks, with each students details being entered into a 2-D Array upon
: the click of a command button. There is also a list box and another
command
: button which will display the contents of the array. I have next to
nothing
: done but I'll post it anyway. Thank you.
:
: Option Explicit
: Dim Details(1 To 20, 1 To 3) As String
: Dim Index As Integer
:
: Private Sub cmdAddToArray_Click()
: Index = Index + 1
: Details(Index, 1) = txtMark1.Text
: Details(Index, 2) = txtMark2.Text
: Details(Index, 3) = txtMark3.Text
: End Sub
:
: