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

C#

 
AnswerRe: Code-Behind doesn't show Pin
Jasmine250122-Apr-13 8:47
Jasmine250122-Apr-13 8:47 
AnswerRe: Code-Behind doesn't show Pin
Abhinav S22-Apr-13 18:03
Abhinav S22-Apr-13 18:03 
Questionfinding square root of a number using scilab functions Pin
Member 913191921-Apr-13 20:52
Member 913191921-Apr-13 20:52 
AnswerRe: finding square root of a number using scilab functions Pin
Marco Bertschi21-Apr-13 21:12
protectorMarco Bertschi21-Apr-13 21:12 
GeneralRe: finding square root of a number using scilab functions Pin
Member 913191921-Apr-13 21:22
Member 913191921-Apr-13 21:22 
GeneralRe: finding square root of a number using scilab functions Pin
Marco Bertschi21-Apr-13 21:40
protectorMarco Bertschi21-Apr-13 21:40 
AnswerRe: finding square root of a number using scilab functions Pin
OriginalGriff21-Apr-13 23:04
mveOriginalGriff21-Apr-13 23:04 
QuestionCalling mongoose API from .NET Pin
Tiger45621-Apr-13 16:57
Tiger45621-Apr-13 16:57 
AnswerRe: Calling mongoose API from .NET Pin
Richard MacCutchan21-Apr-13 22:34
mveRichard MacCutchan21-Apr-13 22:34 
QuestionPersonnel IO Pin
behrouz shamlo21-Apr-13 5:33
behrouz shamlo21-Apr-13 5:33 
AnswerRe: Personnel IO Pin
Pete O'Hanlon21-Apr-13 5:48
mvePete O'Hanlon21-Apr-13 5:48 
GeneralRe: Personnel IO Pin
behrouz shamlo21-Apr-13 6:25
behrouz shamlo21-Apr-13 6:25 
GeneralRe: Personnel IO Pin
Pete O'Hanlon21-Apr-13 6:32
mvePete O'Hanlon21-Apr-13 6:32 
AnswerRe: Personnel IO Pin
Eddy Vluggen21-Apr-13 8:39
professionalEddy Vluggen21-Apr-13 8:39 
GeneralRe: Personnel IO Pin
behrouz shamlo21-Apr-13 11:18
behrouz shamlo21-Apr-13 11:18 
GeneralRe: Personnel IO Pin
Eddy Vluggen21-Apr-13 11:26
professionalEddy Vluggen21-Apr-13 11:26 
GeneralRe: Personnel IO Pin
behrouz shamlo21-Apr-13 19:28
behrouz shamlo21-Apr-13 19:28 
GeneralRe: Personnel IO Pin
Pete O'Hanlon21-Apr-13 21:23
mvePete O'Hanlon21-Apr-13 21:23 
GeneralRe: Personnel IO Pin
Eddy Vluggen21-Apr-13 22:54
professionalEddy Vluggen21-Apr-13 22:54 
Questioncrystal report visual studio 2010 Pin
kalaiselvansurya21-Apr-13 4:17
kalaiselvansurya21-Apr-13 4:17 
QuestionWPF: Add child node to TreeView for other thread Pin
Boltian21-Apr-13 1:41
Boltian21-Apr-13 1:41 
AnswerRe: WPF: Add child node to TreeView for other thread Pin
Dave Kreskowiak21-Apr-13 4:14
mveDave Kreskowiak21-Apr-13 4:14 
GeneralRe: WPF: Add child node to TreeView for other thread Pin
Boltian6-May-13 6:43
Boltian6-May-13 6:43 
GeneralRe: WPF: Add child node to TreeView for other thread Pin
Dave Kreskowiak6-May-13 7:34
mveDave Kreskowiak6-May-13 7:34 
Questionerro ao fazer um calculo deixando o campo desconto vazio! Pin
Member 1000184520-Apr-13 17:55
Member 1000184520-Apr-13 17:55 
C#
Olá amigos dos forum! eu tenho um método para calcular as textbox de um form caixa loja, até ai tudo bem! mais digamos que eu não preencha o campo desconto na compra de um cliente e precise calcular apenas os campos valorUnit * quantidade? como faço pra tratar o campo desconto, para não dá erro na hora de calcular?
o método que estou usando abaixa parece perfeito, mais quando eu clico no botão "calcula" ele não execulta nenhuma ação... Obrigado a todos por qualquer ajuda? segue o ex:


//Método para verificar se os valoreres das textboxs txtValorUnitario, txtQuantidade, txtValorPago são validos
        private bool Valida(params string[] valores)
        {
           return valores.Aggregate(true, (current, v) => current & TypeDescriptor.GetConverter(typeof(double)).IsValid(v));
        }
        //Método calcula textbox
        private void calcula()
        {
            if (Valida(txtValorUnitario.Text, txtQuantidade.Text, txtValorPago.Text))
            {
                double valorUnitario, quantidade, desconto, valorPago, troco, total;
                valorUnitario = Convert.ToDouble(txtValorUnitario.Text);
                quantidade = Convert.ToDouble(txtQuantidade.Text);
                valorPago = Convert.ToDouble(txtValorPago.Text);
                double.TryParse(txtDesconto.Text, out desconto);

                total = (valorUnitario * quantidade) - desconto;
                troco = valorPago - total;

                txtValorTotal.Text = String.Format("{0:C}", total);
                txtTroco.Text = String.Format("{0:C}", troco);
                txtTotal.Text = String.Format("{0:C}", total);
            }
        }

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.