Re: Need a solution for this
I have to say, I really don't think you've thought about this very hard.
vb.net Code:
Dim loc As New Location
loc.ID = id
loc.LName = lName
loc.LDesc = ldesc
Locations.Add(loc)
You've almost certainly done the very same same thing in the past. It's just logical: create the object, populate its members, then add it to the list.
A couple more points to make.
1. That type should be a structure, not a class, unless you have some specific reason you need it to be a reference type.
2. Class or structure, if you'd used properties instead of fields then you could have used initialiser syntax:
vb.net Code:
Locations.Add(New Location With {.ID = id, .LName = lName, .LDesc = lDesc})
Re: Need a solution for this
OK I have this solved now. I am uploading the source so it's easier to look at what I need help with.
In the program, I have the back forward and add running. I would like to implement an autonumber feature. right now, the location class has an ID field but its not being used. how can I implement an id field. here is what i am looking for.
It needs to auto increment. It has to skip ids that are already in the list.:afrog:
1 Attachment(s)
Re: Need a solution for this
I am having trouble with attachements. here I go again ...
Re: Need a solution for this
This new questions has nothing to do with the old so it should have been asked in a new thread. One thread per topic and one topic per thread please.
Are you storing the data in a database? If so then you should let the database generate the IDs. Pretty much all databases provide that functionality, e.g. SQL Server allows you to make a column an identity, which will generate sequential IDs as data is inserted.