Datagridview1 show

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

mipakteh

Guest
I have datagridview in form2 .The Column1 data is from list of string from form1.All data show ike bellow;

1542636.png

Expected show in datagridview is;

1542637.png

Option Strict On
Option Explicit On

Imports System.IO
Imports System.Data
Imports System.Text


Imports System.Text.RegularExpressions
Public Class Form1
Dim A_ As New List(Of String)
Dim B_ As New List(Of String)

Public C_ As New List(Of String)
Public D_ As New List(Of String)

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

A_.Add("Max:15(7)Min :4(6)Min :4(8)")
A_.Add("Max:14(8)Min :6(3)Min :6(6)")
A_.Add("Max:16(7)Min :5(0)Min :5(8)")
A_.Add("Max:14(2)Min :5(7)Min :5(8)")
A_.Add("Max:14(3)Min :6(0)Min :6(4)")
A_.Add("Max:18(0)Min :6(4)Min :6(7)")
A_.Add("Max:16(9)Min :4(1)Min :4(8)")
A_.Add("Max:16(2)Min :6(6)Min :6(7)")
A_.Add("Max:15(8)Min :6(0)Min :6(9)")
A_.Add("Max:14(2)Min :5(3)Min :5(5)")
A_.Add("Max:16(7)Min :5(2)Min :5(9)")
A_.Add("Max:15(6)Min :6(0)Min :6(9)")
A_.Add("Max:13(6)Min :6(1)Min :6(8)")

For I As Integer = 0 To A_.Count - 1
Me.TextBox1.AppendText(A_(I) & vbCrLf)
Next


End Sub

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

For I As Integer = 0 To A_.Count - 1
Dim List As String = A_(I)

Dim reg As Regex = New Regex("(?is)(?<=\()[^\)]+(?=\))")
Dim mc As MatchCollection = reg.Matches(List)


For Each m As Match In mc
Me.TextBox2.AppendText(m.Value)
C_.Add(m.Value)
Next
Me.TextBox2.AppendText(vbCrLf)
Next

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

Form2.Show()

End Sub


End Class

Option Strict On
Option Explicit On

Imports System.IO
Imports System.Data
Imports System.Text

Public Class Form2


Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Dim Bundle As New List(Of String)

For I As Integer = 0 To Form1.C_.Count - 1
Bundle.Add(Form1.C_(I))
Next

With DataGridView1

.Columns.Add("Column1", "Data_1")
.Columns.Add("Column2", "Data_2")
.Columns.Add("Column3", "Result")

For Each v As String In Bundle
.Rows.Add(v)
Next

.AutoResizeRows()

End With

End Sub

End Class






thank All

Continue reading...
 

Similar threads

Back
Top