Results 1 to 3 of 3

Thread: [RESOLVED] Datagridview --> loop or array?

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2013
    Posts
    28

    Resolved [RESOLVED] Datagridview --> loop or array?

    Hi,

    I would like to fill the first row of my datagridview with the values “0.02” to “0.20”. Cause there are “only” 10 rows it can be done like this

    Code:
            DataGridView1.RowCount = 10
            DataGridView1.Rows(0).Cells(0).Value = "0.02"
            DataGridView1.Rows(1).Cells(0).Value = "0.04"
            DataGridView1.Rows(2).Cells(0).Value = "0.06"
            DataGridView1.Rows(3).Cells(0).Value = "0.08"
            DataGridView1.Rows(4).Cells(0).Value = "0.10"
            DataGridView1.Rows(5).Cells(0).Value = "0.12"
            DataGridView1.Rows(6).Cells(0).Value = "0.14"
            DataGridView1.Rows(7).Cells(0).Value = "0.16"
            DataGridView1.Rows(8).Cells(0).Value = "0.18"
            DataGridView1.Rows(9).Cells(0).Value = "0.20"

    but in case there are more (i.e. 150) it’s way to complicated. Is there an easier way (like a loop or an array)?

    The other rows will be filled later with different variables and stuff

    Cheers
    Moritz
    Last edited by Moritz83; May 7th, 2013 at 04:03 AM.

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