Good day, all. I am a new VB.NET beginner. I have an issue to have a loop for iteration for my datagridview data table, which is the data from the excel file.
For example: The table looks like this:
Col1 |Col2 |Col3 | Col4
a;b |c;d |A001 |C004
a;b |c;d |B001 |C005
I would like the output to become like this:
Col1 |Col2 |Col3 |Col4
a |c |A001 |C004
b |d |A001 |C004
a |d |A001 |C004
b |c |A001 |C004
a |c |B001 |C005
b |d |B001 |C005
a |d |B001 |C005
b |c |B001 |C005
Which means each row of the data of Col1 and Col2 will be separated and iterate to become 4 rows in datagridview.
Currently, I can display the data as datatable to datagridview only, without the loop of iteration on the datagridview row. May I know how should the coding look like for the loop to iterate on the data to 4 rows? I am very weak at VB.NET coding, so I need help with the coding.
Can someone provide me some coding examples so that I can have an idea of how to write the loop to iterate on the data as soon as possible? I had stuck in this issue for a few days already.
And I appreciate all the help!!
What I have tried:
For k = 0 To DataGridView1.Rows.Count - 1
Dim j As Integer = 1
For j = 1 To 4
DataGridView1.Rows.Add(row)
j += 1
Next
Next