Click here to Skip to main content
   

C#

 
AnswerRe: help PinmemberEddy Vluggen17-Nov-12 10:25 
AnswerRe: help PinmvpAbhinav S18-Nov-12 21:58 
QuestionAccess to created control PinmemberKKW_acd17-Nov-12 6:18 
AnswerRe: Access to created control PinmentorDaveyM6917-Nov-12 8:30 
QuestionHow do you programatically open a file in c# to append? PinmemberXarzu17-Nov-12 2:05 
AnswerRe: How do you programatically open a file in c# to append? PinmentorDaveyM6917-Nov-12 2:35 
AnswerRe: How do you programatically open a file in c# to append? PinmemberEddy Vluggen17-Nov-12 10:32 
QuestionC# noob: Making Textbox entry a percentage, and Help with loops Pinmembermaul5916-Nov-12 19:46 
Hi, New here, and would be very thankful for any help someone can give me.
 
The code I am working for is a population estimator. It has 3 text boxes, the first is two enter the starting population, the second is to enter the daily increase in that population in a percentage, and the third is the number of days to multiply that by.
 
My first issue is with the second text box. I don't know how to enter the data as a percent. As of now it is only entering as a whole number, so I when I right in text box one the number 2, in box2 the number 30, and in three the number 10, I get the 302. Not 21.209 like it should be.
 
Secondly, it all displays in a listbox, and its supposed to loop for every day you enter. I've got the loop to loop by days, but it just runs the same calculation, I want it make every entry build off the last.
Example:
It should say
2
2.6
3.38
4.394
5.7122
etc
 
I've entered in the code below.
Thanks for any help!
 
private void calculateButton_Click(object sender, EventArgs e)
       {
           int organisms;
           int days;
           int growth;
           int population;
           int count = 1;
 
           if (int.TryParse(OrganismsTextbox.Text, out organisms))
           {
               if (int.TryParse(DailyTextbox.Text, out growth ))
 
               {
 
                   if (int.TryParse(DaysTextbox.Text, out days))
 
                       do
                       {
 
                           population = organisms + growth * days;
                           resultsListbox.Items.Add("The population For day " + count + " is " + population.ToString("n1"));
 

                           count = count + 1;
                       }
                       while (count <= days);

AnswerRe: C# noob: Making Textbox entry a percentage, and Help with loops PinmvpRichard MacCutchan16-Nov-12 21:43 
AnswerRe: C# noob: Making Textbox entry a percentage, and Help with loops PinmvpOriginalGriff16-Nov-12 22:40 
GeneralRe: C# noob: Making Textbox entry a percentage, and Help with loops Pinmembermaul5916-Nov-12 23:20 
GeneralRe: C# noob: Making Textbox entry a percentage, and Help with loops PinmvpOriginalGriff16-Nov-12 23:26 
QuestionInterface issue when implementing Factory pattern PinmemberMichCl16-Nov-12 9:36 
AnswerRe: Interface issue when implementing Factory pattern PinmemberEddy Vluggen16-Nov-12 10:01 
GeneralRe: Interface issue when implementing Factory pattern PinmemberMichCl16-Nov-12 10:18 
GeneralRe: Interface issue when implementing Factory pattern PinmemberEddy Vluggen16-Nov-12 14:46 
GeneralRe: Interface issue when implementing Factory pattern PinmemberMichCl19-Nov-12 3:20 
AnswerRe: Interface issue when implementing Factory pattern PinmemberEddy Vluggen19-Nov-12 3:32 
GeneralRe: Interface issue when implementing Factory pattern PinmemberMichCl19-Nov-12 4:51 
GeneralRe: Interface issue when implementing Factory pattern PinmemberEddy Vluggen19-Nov-12 5:46 
GeneralRe: Interface issue when implementing Factory pattern PinmemberMichCl19-Nov-12 10:38 
GeneralRe: Interface issue when implementing Factory pattern PinmemberEddy Vluggen19-Nov-12 10:53 
QuestionIssue in accessing 32 bit C++ DLL in Windows Server 2008 PinmemberKumaran Poongavanam16-Nov-12 9:32 
AnswerRe: Issue in accessing 32 bit C++ DLL in Windows Server 2008 PinmemberEddy Vluggen16-Nov-12 10:04 
GeneralRe: Issue in accessing 32 bit C++ DLL in Windows Server 2008 PinmemberKumaran Poongavanam16-Nov-12 11:09 

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

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


Advertise | Privacy | Mobile
Web04 | 2.8.150123.1 | Last Updated 25 Jan 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid