Array
-
I am working on a program that stores peoples data, only while the program is running thouugh. I want to create an array to store thier details. I want to store 10 users details. I have: txtName = Their Name textbox txtAddress = Their address textbox txtAddress1 = Their address textbox txtAddress3 = Their address textbox txtPhone = Their phone number I also want to store whats in cmbboxCar = car list combobox I have a button called "txtStore" that will store the details when pressed, but don't know to do that. I have a numericupdown = detnumber which when value is increased/decreased I want it to display whats stored in the current array index number. Say "5" was selected in the numericupdown, I want the details for person 5 to appear in all textboxes, comboboxes. But I want the updown to only go as high as the number of values stored. e.g. if 6 users details were stored, the numericupdown wont go higher. Any ideas? Thanks in advance
In the end we're all just the same
-
I am working on a program that stores peoples data, only while the program is running thouugh. I want to create an array to store thier details. I want to store 10 users details. I have: txtName = Their Name textbox txtAddress = Their address textbox txtAddress1 = Their address textbox txtAddress3 = Their address textbox txtPhone = Their phone number I also want to store whats in cmbboxCar = car list combobox I have a button called "txtStore" that will store the details when pressed, but don't know to do that. I have a numericupdown = detnumber which when value is increased/decreased I want it to display whats stored in the current array index number. Say "5" was selected in the numericupdown, I want the details for person 5 to appear in all textboxes, comboboxes. But I want the updown to only go as high as the number of values stored. e.g. if 6 users details were stored, the numericupdown wont go higher. Any ideas? Thanks in advance
In the end we're all just the same
If you create a collection and insert the data, you can serialize the collection to disk and then load it again when the program restarts. There are 100's of examples of this on the Internet. Very simple to do, just a few lines of code.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
If you create a collection and insert the data, you can serialize the collection to disk and then load it again when the program restarts. There are 100's of examples of this on the Internet. Very simple to do, just a few lines of code.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
I have the array almost completed and stored array code in module (Bits of the code here): Public txtRemainingBalance(10) As String Public txtCustomerName(10) As String Public txtAddress1(10) As String Public txtAddress2(10) As String Public txtAddress3(10) As String Public txtRegNo(10) As String Public txtCarModel(10) As String Public ComboBox1(10) As String Public txtPurchasePrice(10) As Decimal Sub CalltxtCustomerName() txtCustomerName(0) = "Not Defined" txtCustomerName(1) = "Not Defined" txtCustomerName(2) = "Not Defined" txtCustomerName(3) = "Not Defined" txtCustomerName(4) = "Not Defined" txtCustomerName(5) = "Not Defined" txtCustomerName(6) = "Not Defined" txtCustomerName(7) = "Not Defined" txtCustomerName(8) = "Not Defined" txtCustomerName(9) = "Not Defined" End Sub Sub CalltxtAddress1() txtAddress1(0) = "Not Defined" txtAddress1(1) = "Not Defined" txtAddress1(2) = "Not Defined" txtAddress1(3) = "Not Defined" txtAddress1(4) = "Not Defined" txtAddress1(5) = "Not Defined" txtAddress1(6) = "Not Defined" txtAddress1(7) = "Not Defined" txtAddress1(8) = "Not Defined" txtAddress1(9) = "Not Defined" The "Sub CalltxtCustomerName" and similar names just hold the "Not defined" text that displays when array is run. On my third form, I have list boxes that display whats in the array in listboxes. Here is the code on the display button on that form: ListName.Items.Clear() ListAddress1.Items.Clear() ListAddress.Items.Clear() ListPostcode.Items.Clear() ListCarReg.Items.Clear() ListCarModel.Items.Clear() ListCarCost.Items.Clear() ListCarMake.Items.Clear() Dim i As Integer For i = 0 To 9 ListName.Items.Add(txtCustomerName(i)) ListAddress1.Items.Add(txtAddress1(i)) ListAddress.Items.Add(txtAddress2(i)) ListPostcode.Items.Add(txtAddress3(i)) ListCarReg.Items.Add(txtRegNo(i)) ListCarModel.Items.Add(txtCarModel(i)) ListCarCost.Items.Add(txtPurchasePrice(i)) ListCarMake.Items.Add(ComboBox1(i)) Now, all I want to do is on the form 1 and 2, make a button that stores whats in the text boxes and addes it to the index of the array, txtAddress1, txtAddress2 etc.. and a