home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,067 of 10,840   
   Steven Smith to John   
   Re: Problem adding currency in VB6   
   15 May 06 21:16:23   
   
   XPost: microsoft.public.dotnet.languages.vb, microsoft.public.vb   
   From: sluke4@webbox.com   
      
   Thanks John.... that worked perfectly.   
      
   Ah, the joys of being a newbie!   
      
      
      
   Steve   
      
      
   John  wrote in news:2qnh62tgjmp4j2v2rgoe3li1g89ogdh014@   
   4ax.com:   
      
   > Try converting the text values to numbers before adding them.   
   >   
   >    AmountDue = val(Item1Amt.Text) + val(Item2Amt.Text) +   
   > val(Item3Amt.Text) + val(Item4Amt.Text) + val(Item5Amt.Text) +   
   > val(Item6Amt.Text) + VItem7Amt.Text) + val(Item8Amt.Text) -   
   > val(Item9Amt.Text) - val(ItemAAmt.Text)   
   >   
   >   
   >   
   > On Mon, 15 May 2006 19:05:42 GMT, Steven Smith    
   > wrote:   
   >   
   >>I should probably show you the code in question.....   
   >>   
   >>   
   >>Dim AmountDue As Currency   
   >>    AmountDue = Item1Amt.Text + Item2Amt.Text + Item3Amt.Text +   
   >>Item4Amt.Text + Item5Amt.Text + Item6Amt.Text + Item7Amt.Text +   
   >>Item8Amt.Text - Item9Amt.Text - ItemAAmt.Text   
   >>   
   >>   
   >>   
   >>   
   >>Thanks again...   
   >>   
   >>   
   >>Steven Smith  wrote in   
   >>news:l74ag.25165$Gg.2267@twister.nyroc.rr.com:   
   >>   
   >>> Hi,   
   >>>   
   >>> I'm trying to write a simple program to print invoices for people I   
   do   
   >>> work for. I've got a form with textboxes for descriptions and amounts   
   >>> for items, and some code for printing the invoices. It all works   
   >>> except for the one line that adds all of the item amounts. At run   
   >>> time, a "type mismatch" error is thrown. I've tried a couple of   
   >>> different things, but the code won't work. Is there something special   
   >>> about adding currency I'm missing? I've also tried making everything   
   a   
   >>> string, and when I add amounts, it will just concatenate the strings.   
   >>> Also, this method won't let me subtract discounts.   
   >>>   
   >>> Any help or code snippets would be greatly appreciated.   
   >>>   
   >>> Thanks,   
   >>>   
   >>>   
   >>> Steven Smith   
   >>>   
   >   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca