Click here to Skip to main content
15,909,332 members
Home / Discussions / C#
   

C#

 
AnswerRe: How can I create a program that shows information on DVB-T2 USB and shows it in a noutbook ??? Pin
Dave Kreskowiak9-Feb-18 13:27
mveDave Kreskowiak9-Feb-18 13:27 
QuestionMultiple sliders or trackbars Pin
Member 136704429-Feb-18 8:07
Member 136704429-Feb-18 8:07 
QuestionRe: Multiple sliders or trackbars Pin
Maciej Los9-Feb-18 9:03
mveMaciej Los9-Feb-18 9:03 
AnswerRe: Multiple sliders or trackbars Pin
ZurdoDev9-Feb-18 9:10
professionalZurdoDev9-Feb-18 9:10 
AnswerRe: Multiple sliders or trackbars Pin
BillWoodruff10-Feb-18 23:23
professionalBillWoodruff10-Feb-18 23:23 
GeneralRe: Multiple sliders or trackbars Pin
Member 1367044211-Feb-18 12:59
Member 1367044211-Feb-18 12:59 
GeneralRe: Multiple sliders or trackbars Pin
BillWoodruff11-Feb-18 16:56
professionalBillWoodruff11-Feb-18 16:56 
GeneralRe: Multiple sliders or trackbars Pin
Member 1367028512-Feb-18 0:54
Member 1367028512-Feb-18 0:54 
QuestionHow to add a discrete transfer function in C# code? Pin
Member 136703089-Feb-18 5:21
Member 136703089-Feb-18 5:21 
AnswerRe: How to add a discrete transfer function in C# code? Pin
OriginalGriff9-Feb-18 5:27
mveOriginalGriff9-Feb-18 5:27 
Questiongetting same numbers when executing a random number generation method? Pin
auting828-Feb-18 6:47
auting828-Feb-18 6:47 
AnswerRe: getting same numbers when executing a random number generation method? Pin
Richard Deeming8-Feb-18 7:41
mveRichard Deeming8-Feb-18 7:41 
AnswerRe: getting same numbers when executing a random number generation method? Pin
OriginalGriff8-Feb-18 8:03
mveOriginalGriff8-Feb-18 8:03 
GeneralRe: getting same numbers when executing a random number generation method? Pin
Richard Deeming8-Feb-18 9:23
mveRichard Deeming8-Feb-18 9:23 
QuestionGridview C# Windows Application - Function in each cell column can automatically write words PASS and FAIL Pin
Deden Suansyah7-Feb-18 21:41
Deden Suansyah7-Feb-18 21:41 
AnswerRe: Gridview C# Windows Application - Function in each cell column can automatically write words PASS and FAIL Pin
Deden Suansyah7-Feb-18 21:49
Deden Suansyah7-Feb-18 21:49 
AnswerRe: Gridview C# Windows Application - Function in each cell column can automatically write words PASS and FAIL Pin
Richard MacCutchan7-Feb-18 22:13
mveRichard MacCutchan7-Feb-18 22:13 
GeneralRe: Gridview C# Windows Application - Function in each cell column can automatically write words PASS and FAIL Pin
Deden Suansyah7-Feb-18 23:04
Deden Suansyah7-Feb-18 23:04 
GeneralRe: Gridview C# Windows Application - Function in each cell column can automatically write words PASS and FAIL Pin
Richard MacCutchan7-Feb-18 23:13
mveRichard MacCutchan7-Feb-18 23:13 
AnswerRe: Gridview C# Windows Application - Function in each cell column can automatically write words PASS and FAIL PinPopular
Eddy Vluggen8-Feb-18 1:18
professionalEddy Vluggen8-Feb-18 1:18 
QuestionHow can I enumerate through OU's for nodes and add them to an existing treeview root node? Pin
turbosupramk37-Feb-18 10:35
turbosupramk37-Feb-18 10:35 
AnswerRe: How can I enumerate through OU's for nodes and add them to an existing treeview root node? Pin
BillWoodruff7-Feb-18 16:53
professionalBillWoodruff7-Feb-18 16:53 
Question(beginner question) help with code for a project Pin
Member 136645666-Feb-18 11:14
Member 136645666-Feb-18 11:14 
I have to make an app where the users inputs the # of units they purchased in a text box. Then, they click a "calculate" box and it yields 3 labels: Their % of savings, their amount saved, and their total after savings. Here is my code for the calculate button click event.

So first I declare my variables:

const double PACKAGE_COST_double = 99;

int purchased; //this will be the number they input in the text box.

double retail; //holds the package retail price, before discounts. (purchased * PACKAGE_COST_double)

double discountrate; //the rate at which each package will be discounted. This will depend on what the                                   //entry into the text box is.

double saved; //this will be the amount saved. So this will be = retail - (retail * discountrate)

double total; //this will be the variable that goes into the final label. This will = (retail * discountrate)


Then I have my formulas for each of my variables:

purchased = int.Parse(purchasedTextBox.Text);
saved = (purchased * PACKAGE_COST_double) * discountrate;
retail = purchased * PACKAGE_COST_double;
total = retail * discountrate;
Then I have my if/else statement to determine what the discountrate is going to be:
 if (purchased >= 100)
            {
                discountLabel.Text = "50%";
                discountrate = .5;
            }
            else if (purchased >= 50 && purchased <= 99)
            {
                discountLabel.Text = "40%";
                discountrate = .4;
            }
            else if (purchased >= 20 && purchased <= 49)
            {
                discountLabel.Text = "30%";
                discountrate = .3;
            }
            else if (purchased <= 19 && purchased >= 10)
            {
                discountLabel.Text = "20%";
                discountrate = .2;
            }
            else if (purchased >= 0 && purchased <= 10);
            {
                discountrate = 0;
            }
And at this point I am pretty much lost. I am not sure what to do now. I know I need to incorporate a try/catch, I have a red line under discountrate when I use it in the first formula at the top, and I am not sure where to go from here. Any help/critiques/comments would be greatly appreciated!

AnswerRe: (beginner question) help with code for a project Pin
Eddy Vluggen6-Feb-18 14:34
professionalEddy Vluggen6-Feb-18 14:34 
AnswerRe: (beginner question) help with code for a project Pin
Richard MacCutchan6-Feb-18 23:18
mveRichard MacCutchan6-Feb-18 23:18 

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.