I have an address book that has three arrays declared in a code module:
I need to update/append these arrays when I add a new contact.Code:Module ArrayModule Public mstrAddressArray(9), mstrCityArray(9), mstrPhoneArray(9) As String End Module
I call another form to input the new contact information. I use text boxes to add info. Here is where my problem is. I need to append to the existing array but am unsure how to do that.Code:mstrNewContact = InputBox("Enter the name of the new contact", "Add Contact")
This code
places whatever I type into the txtAddress.textCode:ReDim Preserve mstrAddressArray(mintNewContacts) mstrAddressArray(mintNewContacts) = txtAddress.Text
The code I test to find out the value of mstAddressArray works and displays whatever I typed into txtAddress.text.
This tells me it is being written to the array, however when I click on a name in my list box in my Address Form after I have added a new contact, and click on show details button I get the error "index was outside the bounds of the arrray."Code:lblOutput.Text = mstrAddressArray(mintNewContacts)
Any help is greatly appreciated.
Thanks in advance.




Reply With Quote