Member Avatar for san_fran_crisko

Hi,

I am trying to store details in a Vector and then recall them using different search categories. I'm getting no errors but the details I enter are either not being stored or not being recalled. I don't know what one it is.

I attached the code rather than copy and paste it here as its a bit lengthy but please don't let that put you off having a look. It's a beginner's project and its 250 lines which isn't too long (I think). :confused:

If anyone could help me out on this it would be very much appreciated. :cheesy:

Thanks for your time,

Crisko.

Member Avatar for san_fran_crisko

Apologies to anyone who took the time to look over my code but I've figured out the problem myself. I know that seems like I didn't spend enough time on it myself before posting but I had spent hours all afternoon trying to solve it. The offending code was here:

for (int i=0; i<CDSystem.v.size(); i++) {
                disc = (Details)CDSystem.v.get(i);
            if ((iyearsearch).equals(disc.year)){

I should have closed the "for" loop before I started the "if" statement. Like this:

for (int i=0; i<CDSystem.v.size(); i++) {
                disc = (Details)CDSystem.v.get(i);}
            if ((iyearsearch).equals(disc.year)){

Sorry if I inconvenienced anyone and thanks for taking the time to look over it anyway if you did. I'm still an unexperienced programmer so I was instinctively going after the major problems and subconsciously taking the compile errors semi-literally.

Crisko.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.