In your example code you appear to be trying to do both methods. Pick one. See the comment from @Richard-MacCutchan.
If you go down the datatable route
dgvOne.DataSource = dt
then add 12 blank rows to the
datatable before assigning it to the DataSource.
If you go down the route of manually adding the rows to the datagridview then just add 12 more blank rows in a separate loop after adding your data.
One or the other. Not both.
Other comments
- if you are going to the trouble of stepping through each record in your result set then do all the work within that loop. Not sure why you have a another for-each loop.
- In that for-each loop
For Each item As String In output
you are continuously overwriting
L
,
str1
and
str2
. I suspect that you wanted the
R("Name") = str1 & " " & str2
dt.Rows.Add(R)
actually
inside that loop
- No need for arrays anywhere in this. Nor have you actually used one.
Finally - a bit of advice for getting quicker and better answers ... get rid of commented out lines in the code you present to us here. Especially if you are not using the correct
lang="VB"
in your post. It just clutters up your question, making it more difficult for people to read. Many members will just move on to the next question, which doesn't help you very much.