![]() |
| ||
| can someone help me with saving my data in a file program? I am writing a project that stores vehicle information such as the model,manuf., year, etc. I have to create a second project that loads the data from the file into memory and loads a drop down combo box with the VIN numbers. When the number is selected from the box, it is supposed to display the appropriate information in labels. Im having problems storing my information and creating this project because the book doesn't explain it very well. Can anyone point me in the right direction? |
| ||
| Re: can someone help me with saving my data in a file program? You didn't mention, how the information is stored. But if you have numbers in your combo box and you can fetch the information with that number, you need to trap SelectedIndexChanged for the combo box: Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChangedHope this gets you started. If you still have a problem, you need to tell more details about how you store your information (database, a file...) |
| ||
| Re: can someone help me with saving my data in a file program? Since i'm storing my information in a file, do i need to make a .txt file first and then write the program? Also, Since i'm creating two projects under the same thing, how would i go about making my forms? My first idea was to have a form for the user to enter in the data and then have another form that loads that information from the .txt file. I have in mind what I want to do but I just dont know the right way to execute it. |
| ||
| Re: can someone help me with saving my data in a file program? Here is the code that i have so far, but my .txt file won't execute:
|
| ||
| Re: can someone help me with saving my data in a file program? I think its a good idea to keep data entry and data viewing as separate forms. Here's a bit fixing to data entry form (saveButton_Click). Replace control names (TextBox1 <- modelTextBox etc.) and add missing boxes. ' Declare writerAnd here's the code to read data. You may create an Auto class object but I used structure and array to hold data. This code goes in your "View data"-form. ' Data readerHope this gets you started :) |
| ||
| Re: can someone help me with saving my data in a file program? Since i'm using two forms, how would i get the streamwriter to appear first? My plan was to have the createForm (streamwriter) to have a menu strip so that when the user selects like Open Summary or something, the other form will display for the user to go through the records using the vin number combo box |
| ||
| Re: can someone help me with saving my data in a file program? You mean the data entry form is the "main" form? You can set menu item to disabled (Enabled = False). Or you don't even have to do that. If the user selects "Open Summary" (and the file is empty) the user gets an empty summary form. Here's a fixed "Read Data"-button, which checks first that the file exists. It also closes the StreamReader, a minor bug in my previous posting: Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click |
| All times are GMT -4. The time now is 8:19 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC