Click here to Skip to main content
15,905,028 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to build exe....... Pin
Giorgi Dalakishvili5-May-08 23:58
mentorGiorgi Dalakishvili5-May-08 23:58 
AnswerRe: How to build exe....... Pin
Reelix5-May-08 23:59
Reelix5-May-08 23:59 
AnswerRe: How to build exe....... Pin
Abhijit Jana6-May-08 0:04
professionalAbhijit Jana6-May-08 0:04 
QuestionHow do I start programs from a C# program? Pin
False Chicken5-May-08 22:27
False Chicken5-May-08 22:27 
AnswerRe: How do I start programs from a C# program? Pin
Abhijit Jana5-May-08 22:36
professionalAbhijit Jana5-May-08 22:36 
AnswerRe: How do I start programs from a C# program? Pin
Gareth H5-May-08 22:37
Gareth H5-May-08 22:37 
AnswerRe: How do I start programs from a C# program? Pin
Reelix5-May-08 22:41
Reelix5-May-08 22:41 
QuestionHow to ship my test certificate into the clients machine using c# Pin
ananthrahul5-May-08 22:26
ananthrahul5-May-08 22:26 
Questionsolving maze program Pin
sobu5-May-08 22:22
sobu5-May-08 22:22 
AnswerRe: solving maze program Pin
Abhijit Jana5-May-08 22:47
professionalAbhijit Jana5-May-08 22:47 
AnswerRe: solving maze program Pin
Reelix5-May-08 22:52
Reelix5-May-08 22:52 
AnswerRe: solving maze program Pin
PIEBALDconsult6-May-08 5:45
mvePIEBALDconsult6-May-08 5:45 
QuestionKeeping count of total Pin
MumbleB5-May-08 21:36
MumbleB5-May-08 21:36 
AnswerRe: Keeping count of total Pin
Christian Graus5-May-08 21:58
protectorChristian Graus5-May-08 21:58 
GeneralRe: Keeping count of total Pin
MumbleB5-May-08 23:39
MumbleB5-May-08 23:39 
GeneralRe: Keeping count of total Pin
Christian Graus6-May-08 1:13
protectorChristian Graus6-May-08 1:13 
GeneralRe: Keeping count of total Pin
MumbleB6-May-08 1:25
MumbleB6-May-08 1:25 
GeneralRe: Keeping count of total Pin
Christian Graus6-May-08 1:29
protectorChristian Graus6-May-08 1:29 
GeneralRe: Keeping count of total Pin
Christian Graus6-May-08 22:15
protectorChristian Graus6-May-08 22:15 
void AddItem(string key)
{
if (!objDict.ContainsKey(key))
{
objDict[key] = 1;
}
else
{
++objDict[key];
}
foreach (KeyValuePair<string, int> kvp in objDict)
{
txtboxTot.Text = ("Povince : " + kvp.Key + "\t" + kvp.Value);
}
}


You have two issues

1 - you're setting the textbox value inside the method that is adding them, so it's going to happen every time you add a value
2 - you set the textbox to be the last key/value pair you iterate over, because you do txtboxTot.Text = instead of txtboxTot.Text +=

Factor this code out to run when the loop that adds the values has ended, and have it add the values, instead of just showing the last one looped over. Also, use Environment.NewLine to put newlines in your textbox, if you want them ( make sure you set the textbox to be multiline )

Christian Graus

Please read this if you don't understand the answer I've given you

"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

GeneralRe: Keeping count of total Pin
MumbleB7-May-08 1:56
MumbleB7-May-08 1:56 
GeneralRe: Keeping count of total Pin
Christian Graus7-May-08 11:56
protectorChristian Graus7-May-08 11:56 
QuestionDisplaying a form from en existing form Pin
Berlus5-May-08 21:35
Berlus5-May-08 21:35 
AnswerRe: Displaying a form from en existing form Pin
Abhijit Jana5-May-08 21:55
professionalAbhijit Jana5-May-08 21:55 
AnswerRe: Displaying a form from en existing form Pin
Christian Graus5-May-08 22:00
protectorChristian Graus5-May-08 22:00 
QuestionCheckBox in ListView Pin
stancrm5-May-08 21:28
stancrm5-May-08 21:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.