Results 1 to 3 of 3

Thread: Array problem

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2003
    Posts
    41

    Array problem

    I need a program that takes the original array and replaces each element of the array with its value times 10 by using a for loop.

    So the array is:

    VB Code:
    1. Dim decSales(,) = {{1000, 1200, 900, 500, 20000}, {350, 600, 700, 800, 100}}


    so decSales(0,0) * 10

    would replace the value of decSales(0,0) from 1000 to 10000

    Thanks for your help.

  2. #2
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Array problem

    Try this:

    VB Code:
    1. Dim I As Integer, J As Integer
    2.  
    3. For I = 0 To 4
    4.  
    5.     For J = 0 To 4
    6.  
    7.         decSales(I, J) *= 10
    8.  
    9.     Next J
    10.  
    11. Next I

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Array problem

    Homework anyone?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width