Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

VS 2012 [RESOLVED] Datagridview --> loop or array?

$
0
0
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

Viewing all articles
Browse latest Browse all 27189

Trending Articles