N
NewInTheGame
I'm a beginner in VB.Net. I'm actually taking a class & so far I
understand everything, but I suck when it comes to arrays. I'm sure
that this is simple (I'm ashamed of asking ops: )...
I have some textboxes. I'm trying to store the information in an
array, but I'm lost as to how: I have textboxes for FirstName,
LastName & PhoneNumber.
My problem is that the number of arrays is unknown so our teacher
wants us to declare it as (0) to begin with...this is what I have.
Can someone PLEASE point me to the right direction?
'Declaring the arrays
Dim strFirstName() As String
Dim strLastName() As String
Dim strPhone() As String
Dim intNum As Integer
Private Sub btnSave_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSave.Click
'1st try
intNum = intNum + 1
strFirstName(intNum) = txtFirstName.Text
intNum = intNum + 1
strLastName(intNum) = txtLastName.Text
intNum = intNum + 1
strPhone(intNum) = txtPhone.Text
'2nd try
intNum = intNum + 1
For intNum = intNum To intNum
strFirstName(intNum) = txtFirstName.Text
Next
I'm clueless as to what to try next. Please HELP!!! Thanks.
understand everything, but I suck when it comes to arrays. I'm sure
that this is simple (I'm ashamed of asking ops: )...
I have some textboxes. I'm trying to store the information in an
array, but I'm lost as to how: I have textboxes for FirstName,
LastName & PhoneNumber.
My problem is that the number of arrays is unknown so our teacher
wants us to declare it as (0) to begin with...this is what I have.
Can someone PLEASE point me to the right direction?
'Declaring the arrays
Dim strFirstName() As String
Dim strLastName() As String
Dim strPhone() As String
Dim intNum As Integer
Private Sub btnSave_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSave.Click
'1st try
intNum = intNum + 1
strFirstName(intNum) = txtFirstName.Text
intNum = intNum + 1
strLastName(intNum) = txtLastName.Text
intNum = intNum + 1
strPhone(intNum) = txtPhone.Text
'2nd try
intNum = intNum + 1
For intNum = intNum To intNum
strFirstName(intNum) = txtFirstName.Text
Next
I'm clueless as to what to try next. Please HELP!!! Thanks.