Complicated class

paulthepaddy

Well-known member
Joined
Apr 9, 2011
Messages
222
Location
UK
Programming Experience
Beginner
hi, i didn't really know what to call this thread as it may not be complecated at all :S

my project is for creating invoices for car repairs.

i have a class called car and it has strings for, make,model,reg,colour,damage type, subtotal discount,additonal, total.

so i use dim car1 as new car and set values to the strings but i cant find a way to tell the application that is is finshed with car1 and to move onto car2. i dont really know what information you would need so if you have any ideas and need more info just let me know what you need

i am using a button click event to set th variables an example of why m looking to do, but i no this wont work

VB.NET:
 Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
dim i as integer        
        cari.Make = ComboBox_Car_Maker.Text
        cari.Model = ComboBox_Car_Model.Text
        cari.Colour = ComboBox_Car_Colour.Text
        cari.Reg = TXT_Car_reg.Text
    End Sub

basicly i want to use a variable to determin what car to add the data too
 
Last edited:
I am not sure exactly what you are asking here, if your application only deals with one car at a time you can simply clear the current car and create your new car with the new values. If you will be working with multiple cars at a time you will want some sort of collection that stores your car objects. Also, you would want to consider adding a field that could uniquely identify each car.

paulthepaddy said:
basicly i want to use a variable to determin what car to add the data too

You could simply add a property to your car object that uniquely identifies the car, loop through your collection of cars and add it to the correct one. I am not sure how you would get information about a car without knowing which one it belongs to. More detail / code may prove to be useful.
 
no my application deals with multiple cars, here is a picture of whats going on (layout and just to show things are being done, open to changes and suggestion on layout and componants)
imagre.png

this is the tempary code i used to test to make sure it was writing to the obj abd reading form the obj

VB.NET:
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        car1.Make = ComboBox_Car_Maker.Text
        car1.Model = ComboBox_Car_Model.Text
        car1.Colour = ComboBox_Car_Colour.Text
        car1.Reg = TXT_Car_reg.Text
    End Sub
all that i really need is a method to change car1 to car2 i hope this is enough info but if you need more please state specifically what you need :D
 
problem solved i think, added a finished booleon and is set to false by feault, could just use if statements t determin which one to use
 
Back
Top