Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

I am designing a winForm for GPA Calculation.

check out the image :: https://lh6.googleusercontent.com/-d1n8iNQekCo/UccAuc7Te1I/AAAAAAAAB10/fnZCnZVGDxo/w493-h551-no/issue.png[^]

Check that grade combo box.

If user select 's' , 'a' etc. program should get these values as '5' , '4' etc..

How to implement in code.

Also give me any suggestion to implement this in easy way..

[Edit]Made able to click on the link to the image - ProgramFOX[/Edit]
Posted
Updated 23-Jun-13 4:37am
v6
Comments
OriginalGriff 23-Jun-13 10:15am    
Urgency deleted: It may be urgent to you, but it isn't to us. All that your stressing the urgency does is to make us think you have left it too late, and want us to do it for you. This annoys some people, and can slow a response.
Aravin.it 23-Jun-13 10:17am    
(sorry)
[no name] 23-Jun-13 10:26am    
You need to figure what language you are using first. The answer you get is going to be very different for C and C# since they are not even close to being the same.
Aravin.it 23-Jun-13 10:27am    
What is your problem in this :O
[no name] 23-Jun-13 10:34am    
Well first of all, I am not the one with the problem or attitude. Secondly, your question was not clear on how you expect to use the C programming language in a Winforms application. And thirdly, you have not demonstrated what you have tried to do yourself to solve your problem.

Hi,

Use a Dictionary:
http://msdn.microsoft.com/en-us/library/xfhwa508.aspx[^]
C#
Dictionary<string, int> integers = new Dictionary<string, int>();
public Form1()
{
     InitializeComponent();
     integers.Add("S", 5);
     integers.Add("A", 4);
     // do this for all your values
}

And when you should get the int value from the selected option:
C#
int intValue = integers[(string)yourComboBox.SelectedItem];

Hope this helps.
 
Share this answer
 
Fill the Text property of DDL as string that you want and in the Value property corresponding Integer value and get this integer value in your code and use this for furthere coding manner.

as your DDL id is as id="grade" then

int GradeValue=int.Parse(grade.Value);
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900