Columns in Datagridview

  • Thread starter Thread starter mipakteh
  • Start date Start date
M

mipakteh

Guest
Hi All,

I want put the value in column1 and column2 separately.The source come from List of string .

list from A_22 put in column1 then list from A_33 put in column2.Somebody can show me how

to do it.

Option Strict On
Option Explicit On

Imports System.IO

Public Class Form1

Dim A_22 As New List(Of String)
Dim A_33 As New List(Of String)

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'File Text = A_22
'0 ,2 ,
'3 ,8 ,

'File Text = A_33
'30 ,39 ,36 ,09 ,06 ,
'12 ,15 ,12 ,25 ,22 ,


A_22.AddRange(IO.File.ReadAllLines("C:\Users\60129\Documents\Test_22.txt"))
A_33.AddRange(IO.File.ReadAllLines("C:\Users\60129\Documents\Test_33.txt"))

DataGridView1.ColumnCount = 2
DataGridView1.Columns(0).Name = "Column1"
DataGridView1.Columns(1).Name = "Column2"

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

For Each v As String In A_33
For Each row As DataGridViewRow In DataGridView1.Rows
row.Cells("Column2").Value=v
Next
Next

End Sub

End Class

Continue reading...
 
Back
Top