Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. error message at runtime [modified] .... resolved

error message at runtime [modified] .... resolved

Scheduled Pinned Locked Moved Visual Basic
data-structureshelp
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Daniel Engelkes
    wrote on last edited by
    #1

    when running application when program hits this code I get this error.

         For y As Integer = 0 To frmtodayscafe.count
              For x As Integer = 2 To 12
    
              writeline1(x) = filename(y) + vbTab + frmtodayscafe.totalitemquantity(y) + vbTab + FormatCurrency(filename1(y)) + vbTab + vbTab + FormatCurrency(frmtodayscafe.cost(y))
                           
              Next
          Next
    

    cheeseburger is assign to filename(y) which is declared as a string array filename1(y) is a numeric value cost of the cheeseburger. writeline1(x) is also a string array. by changing the code to the following:

     writeline(x) = filename(y) + vbTab + format(frmtodayscafe.totalitemquantity(y)) + vbTab + FormatCurrency(filename1(y)) + vbTab + vbTab + FormatCurrency(frmtodayscafe.cost(y))
    

    modified on Monday, March 8, 2010 12:30 PM

    T R D 3 Replies Last reply
    0
    • D Daniel Engelkes

      when running application when program hits this code I get this error.

           For y As Integer = 0 To frmtodayscafe.count
                For x As Integer = 2 To 12
      
                writeline1(x) = filename(y) + vbTab + frmtodayscafe.totalitemquantity(y) + vbTab + FormatCurrency(filename1(y)) + vbTab + vbTab + FormatCurrency(frmtodayscafe.cost(y))
                             
                Next
            Next
      

      cheeseburger is assign to filename(y) which is declared as a string array filename1(y) is a numeric value cost of the cheeseburger. writeline1(x) is also a string array. by changing the code to the following:

       writeline(x) = filename(y) + vbTab + format(frmtodayscafe.totalitemquantity(y)) + vbTab + FormatCurrency(filename1(y)) + vbTab + vbTab + FormatCurrency(frmtodayscafe.cost(y))
      

      modified on Monday, March 8, 2010 12:30 PM

      T Offline
      T Offline
      TremaHD
      wrote on last edited by
      #2

      Where come from the value "cheeseburger"? Which variable hold that value? Are you trying to do a "FormatCurrency" on that value?

      D 1 Reply Last reply
      0
      • T TremaHD

        Where come from the value "cheeseburger"? Which variable hold that value? Are you trying to do a "FormatCurrency" on that value?

        D Offline
        D Offline
        Daniel Engelkes
        wrote on last edited by
        #3

        cheeseburger is a string loaded from a file .... I am trying to write the string to a concatenated string to include qty, pricing, and total pricing. it should say on the string cheeseburger 1 $3.00 $3.00

        T 1 Reply Last reply
        0
        • D Daniel Engelkes

          cheeseburger is a string loaded from a file .... I am trying to write the string to a concatenated string to include qty, pricing, and total pricing. it should say on the string cheeseburger 1 $3.00 $3.00

          T Offline
          T Offline
          TremaHD
          wrote on last edited by
          #4

          What is the type of writeline1(x)? Is it a string or double?

          D 1 Reply Last reply
          0
          • T TremaHD

            What is the type of writeline1(x)? Is it a string or double?

            D Offline
            D Offline
            Daniel Engelkes
            wrote on last edited by
            #5

            wireline1 is a string array

            1 Reply Last reply
            0
            • D Daniel Engelkes

              when running application when program hits this code I get this error.

                   For y As Integer = 0 To frmtodayscafe.count
                        For x As Integer = 2 To 12
              
                        writeline1(x) = filename(y) + vbTab + frmtodayscafe.totalitemquantity(y) + vbTab + FormatCurrency(filename1(y)) + vbTab + vbTab + FormatCurrency(frmtodayscafe.cost(y))
                                     
                        Next
                    Next
              

              cheeseburger is assign to filename(y) which is declared as a string array filename1(y) is a numeric value cost of the cheeseburger. writeline1(x) is also a string array. by changing the code to the following:

               writeline(x) = filename(y) + vbTab + format(frmtodayscafe.totalitemquantity(y)) + vbTab + FormatCurrency(filename1(y)) + vbTab + vbTab + FormatCurrency(frmtodayscafe.cost(y))
              

              modified on Monday, March 8, 2010 12:30 PM

              R Offline
              R Offline
              RCoate
              wrote on last edited by
              #6

              You are doing a FormatCurrency on a string value of "Cheeseburger". I know of few countries where cheeseburgers are legal tender. You may want to try the amount (double) rather than the file name (string).

              D 1 Reply Last reply
              0
              • R RCoate

                You are doing a FormatCurrency on a string value of "Cheeseburger". I know of few countries where cheeseburgers are legal tender. You may want to try the amount (double) rather than the file name (string).

                D Offline
                D Offline
                Daniel Engelkes
                wrote on last edited by
                #7

                filename(0) = cheeseburger filename1(0) = 5.00 filename1(0) is being formatted to currency by not filename(0) cheeseburger is not being formatted as double.

                1 Reply Last reply
                0
                • D Daniel Engelkes

                  when running application when program hits this code I get this error.

                       For y As Integer = 0 To frmtodayscafe.count
                            For x As Integer = 2 To 12
                  
                            writeline1(x) = filename(y) + vbTab + frmtodayscafe.totalitemquantity(y) + vbTab + FormatCurrency(filename1(y)) + vbTab + vbTab + FormatCurrency(frmtodayscafe.cost(y))
                                         
                            Next
                        Next
                  

                  cheeseburger is assign to filename(y) which is declared as a string array filename1(y) is a numeric value cost of the cheeseburger. writeline1(x) is also a string array. by changing the code to the following:

                   writeline(x) = filename(y) + vbTab + format(frmtodayscafe.totalitemquantity(y)) + vbTab + FormatCurrency(filename1(y)) + vbTab + vbTab + FormatCurrency(frmtodayscafe.cost(y))
                  

                  modified on Monday, March 8, 2010 12:30 PM

                  D Offline
                  D Offline
                  Daniel Engelkes
                  wrote on last edited by
                  #8

                  by changing the code to the following has resolved issues. there are no more errors at runtime.

                    writeline(x) = filename(y) + vbTab + format(frmtodayscafe.totalitemquantity(y)) + vbTab + FormatCurrency(filename1(y)) + vbTab + vbTab + FormatCurrency(frmtodayscafe.cost(y))
                  
                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups