Click here to Skip to main content
15,895,011 members
Home / Discussions / C#
   

C#

 
GeneralRe: Webserver only sending text occasionally? Pin
venomation9-Apr-11 4:59
venomation9-Apr-11 4:59 
AnswerRe: Webserver only sending text occasionally? Pin
BobJanova11-Apr-11 5:10
BobJanova11-Apr-11 5:10 
QuestionHow to get a value to return in a textbox Pin
Justiin12658-Apr-11 12:15
Justiin12658-Apr-11 12:15 
AnswerRe: How to get a value to return in a textbox Pin
Colin Angus Mackay8-Apr-11 14:15
Colin Angus Mackay8-Apr-11 14:15 
GeneralRe: How to get a value to return in a textbox Pin
Justiin12658-Apr-11 16:28
Justiin12658-Apr-11 16:28 
AnswerRe: How to get a value to return in a textbox Pin
Luc Pattyn8-Apr-11 15:01
sitebuilderLuc Pattyn8-Apr-11 15:01 
GeneralRe: How to get a value to return in a textbox Pin
Justiin12658-Apr-11 16:39
Justiin12658-Apr-11 16:39 
AnswerRe: How to get a value to return in a textbox Pin
Luc Pattyn8-Apr-11 17:10
sitebuilderLuc Pattyn8-Apr-11 17:10 
OK. It is a bit clearer now. Still not sure what it is that gets scanned (a serial number? a repair cost label?)

Here is a simple scheme that is bound to work:
- have a class member "int countAccepted", initially zero.
- have a class member "int countRejected", initially zero.
- have an "Accept" button, when clicked it increments countAccepted and calls method Calc().
- have a "Reject" button, when clicked it increments countRejected and calls method Calc().

public void btnAccepted_Clicked(object sender, EventArgs e) {
    countAccepted++;
    Calc();
}

public void btnRejected_Clicked(object sender, EventArgs e) {
    countRejected++;
    Calc();
}

public void Calc() {
    int totalCount=countAccepted+countRejected;
    if (totalCount!=0) {
        int rejectedRate=100*countRejected/totalCount;
        textBoxAccepted.Text=countAccepted.ToString();
        textBoxRejected.Text=countRejected.ToString();
        textBoxRejectedRate.Text=rejectedRate.ToString()+" %";
    }
}


So the trick here is I'm using two buttons.

If there were a TextBox that accepts the barcode reader's input, then the TextBox.TextChanged event handler would have to update the counters appropriately, then call Calc().

public void BarcodeReaderTextBox_TextChanged(object sender, EventArgs e) {
    // first decide which counter to increment, depending on ...
    ...
    // then recalculate
    Calc();
}


HTH

Suggestion: if you manage to clearly state your problem in plain English, it will also be easier for yourself to turn it into working code.

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

AnswerRe: How to get a value to return in a textbox Pin
davidnz8-Apr-11 15:32
davidnz8-Apr-11 15:32 
GeneralRe: How to get a value to return in a textbox Pin
Justiin12658-Apr-11 16:44
Justiin12658-Apr-11 16:44 
GeneralRe: How to get a value to return in a textbox Pin
Rotted Frog8-Apr-11 22:29
Rotted Frog8-Apr-11 22:29 
Questionthread.interrupt only working once Pin
Member 74021668-Apr-11 10:40
Member 74021668-Apr-11 10:40 
AnswerRe: thread.interrupt only working once Pin
davidnz8-Apr-11 12:13
davidnz8-Apr-11 12:13 
AnswerRe: thread.interrupt only working once Pin
Ganesh Kumar Kaki13-Apr-11 1:27
Ganesh Kumar Kaki13-Apr-11 1:27 
QuestionGlobal Hook : need help with SysMsgProc Pin
moums8-Apr-11 8:12
moums8-Apr-11 8:12 
QuestionQuerying LDAP from an application: get a search result when one attribute of a multiple attribute matches Pin
Bernhard Hiller8-Apr-11 1:28
Bernhard Hiller8-Apr-11 1:28 
AnswerRe: Querying LDAP from an application: get a search result when one attribute of a multiple attribute matches Pin
Ravi Bhavnani8-Apr-11 9:10
professionalRavi Bhavnani8-Apr-11 9:10 
QuestionWindow 7 and WebClient Class Pin
Wolfram Steinke7-Apr-11 17:32
Wolfram Steinke7-Apr-11 17:32 
AnswerRe: Window 7 and WebClient Class Pin
Bernhard Hiller7-Apr-11 21:58
Bernhard Hiller7-Apr-11 21:58 
GeneralRe: Window 7 and WebClient Class Pin
Wolfram Steinke9-Apr-11 0:20
Wolfram Steinke9-Apr-11 0:20 
AnswerRe: Window 7 and WebClient Class Pin
#realJSOP8-Apr-11 8:07
mve#realJSOP8-Apr-11 8:07 
AnswerRe: Window 7 and WebClient Class Pin
Ravi Bhavnani8-Apr-11 11:27
professionalRavi Bhavnani8-Apr-11 11:27 
QuestionA problem with ListView in VB.Net [modified] Pin
yoh.asakura7-Apr-11 7:12
yoh.asakura7-Apr-11 7:12 
GeneralRe: A problem with ListView in VB.Net Pin
Pete O'Hanlon7-Apr-11 7:16
mvePete O'Hanlon7-Apr-11 7:16 
GeneralRe: A problem with ListView in VB.Net Pin
Colin Angus Mackay8-Apr-11 14:09
Colin Angus Mackay8-Apr-11 14:09 

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.