Please help an Amateur

The user just have to Select the number of courses offered, then select the grade obtain in the different courses by choosing the appropriate grade from the Choice Box.

The problem with my application is that, if the user mistakenly selects "A" instead of "B", then he corrects his mistake by selecting "B", the program sums up all the selections, including the wrong selection. So the calculation ends up being wrong.

Another proble with my application is that, u can't select an item twice. i.e if a user, selects "A" in the first Choice box, he can't select "A" again in the same Choice box, in case he wants to do another calculation.

It seems to me that the problem isn't in the code, it's in the design of the GUI. In general you can't neatly make repeated selections or delete errors just by making selections in a list of choices. At the very least you could have "Add" and "Delete" buttons which would allow the user to select a grade then add that or delete it from the total. A field showing the current list of grades as they are enterd would be good feedback for the user, (but not essential).

But if you really want to stick with one list of choices then (a) clear the selection after each user selection is processed - this will allow the user to select the same grade twice, and (b) have a choice "oops! - please delete the last selection"