M
mipakteh
Guest
Hi All,
I have strings and put into the List C_ and put again in List C_Items.
List C_ show in TextBox1
By Click Button_1 in Form1,we remove all string List C_Items but not in string in bracket only.
and put into List Sep_.
The List Sep_ we call back on Form2_Load.The result show like bellow
54673938
What I want and expected result like this in TextBox1 on Form2,
54
67
39
38
Hope somebody correct this code,Thank All.
Option Strict On
Option Explicit On
Imports System.IO
Imports System.Data
Imports System.Text
Imports System.Text.RegularExpressions
Public Class Form1
Dim C_ As New List(Of String)
Dim C_Items_ As New List(Of String)
Public Sep_ As New List(Of String)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
C_.Add("Max = 14(5) ,Min =4(4) ,")
C_.Add("Max = 16(6), Min = 4(7) ,")
C_.Add("Max = 13(3), Min = 6(9) ,")
C_.Add("Max = 15(3), Min = 5(8) ,")
For I As Integer = 0 To C_.Count - 1
TextBox1.AppendText(C_(I) & vbCrLf)
C_Items_.Add(C_(I) & vbCrLf)
Next
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sb_3 As New StringBuilder
For I As Integer = 0 To C_Items_.Count - 1
Dim List As String = C_Items_(I)
Dim reg As Regex = New Regex("(?is)(?<=\()[^\)]+(?=\))")
Dim mc As MatchCollection = reg.Matches(List)
For Each m As Match In mc
sb_3.Append(m.Value)
Sep_.Add(m.Value)
Next
sb_3.Append(vbCrLf)
Next
Me.TextBox2.AppendText(sb_3.ToString)
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Form2.Show()
End Sub
End Class
Public Class Form2
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.TextBox1.Clear()
For I As Integer = 0 To Form1.Sep_.Count - 1
Me.TextBox1.AppendText(Form1.Sep_(I))
Next
End Sub
End Class
Continue reading...
I have strings and put into the List C_ and put again in List C_Items.
List C_ show in TextBox1
By Click Button_1 in Form1,we remove all string List C_Items but not in string in bracket only.
and put into List Sep_.
The List Sep_ we call back on Form2_Load.The result show like bellow
54673938
What I want and expected result like this in TextBox1 on Form2,
54
67
39
38
Hope somebody correct this code,Thank All.
Option Strict On
Option Explicit On
Imports System.IO
Imports System.Data
Imports System.Text
Imports System.Text.RegularExpressions
Public Class Form1
Dim C_ As New List(Of String)
Dim C_Items_ As New List(Of String)
Public Sep_ As New List(Of String)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
C_.Add("Max = 14(5) ,Min =4(4) ,")
C_.Add("Max = 16(6), Min = 4(7) ,")
C_.Add("Max = 13(3), Min = 6(9) ,")
C_.Add("Max = 15(3), Min = 5(8) ,")
For I As Integer = 0 To C_.Count - 1
TextBox1.AppendText(C_(I) & vbCrLf)
C_Items_.Add(C_(I) & vbCrLf)
Next
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sb_3 As New StringBuilder
For I As Integer = 0 To C_Items_.Count - 1
Dim List As String = C_Items_(I)
Dim reg As Regex = New Regex("(?is)(?<=\()[^\)]+(?=\))")
Dim mc As MatchCollection = reg.Matches(List)
For Each m As Match In mc
sb_3.Append(m.Value)
Sep_.Add(m.Value)
Next
sb_3.Append(vbCrLf)
Next
Me.TextBox2.AppendText(sb_3.ToString)
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Form2.Show()
End Sub
End Class
Public Class Form2
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.TextBox1.Clear()
For I As Integer = 0 To Form1.Sep_.Count - 1
Me.TextBox1.AppendText(Form1.Sep_(I))
Next
End Sub
End Class
Continue reading...