M
mipakteh
Guest
Hi All,
sorry re-post back pevious question.Just for learning vb and very sorry about uncomfortable.
Hope somebody correct this code.
I try explain again what I try to do
1. List A_("768")
Make combination in first line "786,687,678,876,867"
2. List A_("836")
Make combination in second line "863,368,386,683,638"
3. List B_.Having 3 digit
First line B_ ;
"613,613,633,133,305,300,350,050,654,653,643,543,161,166,116,616,392,393,323,923,834,835,845,345,201,542,"
second line B_ ;
"635,638,658,358,142,142,122,422,694,696,646,946,429,427,497,297,824,822,078,242,543,547,201,437,386,411,"
4.I want to find all combination in first line List A_in first line List B_ and then find all combination in second line List A_in second line List B_
5. Output in textbox4 is
768=0
786=0
687=0
678=0
876=0
867=0
result first line=0
836=0
863=0
368=0
386=1
683=0
638=1
result first line=2
Option Strict On
Option Explicit On
Imports System.IO
Imports System.Data
Imports System.Text
Public Class Form1
Dim A_ As New List(Of String)
Dim B_ As New List(Of String)
Dim C_ As New List(Of String)
Dim D_ As New List(Of String)
Dim A1_ As New List(Of String)
Dim B1_ As New List(Of String)
Dim C1_ As New List(Of String)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
A_.Add("768")
A_.Add("836")
For I As Integer = 0 To A_.Count - 1
TextBox1.AppendText(A_(I) & vbCrLf)
Next
B_.Add("613,613,633,133,305,300,350,050,654,653,643,543,161,166,116,616,392,393,323,923,834,835,845,345,201,542,")
B_.Add("635,638,658,358,142,142,122,422,694,696,646,946,429,427,497,297,824,822,078,242,543,547,201,437,386,768,")
For I As Integer = 0 To B_.Count - 1
TextBox2.AppendText(B_(I) & vbCrLf)
Next
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
For I As Integer = 0 To A_.Count - 1
Dim StringToCheck As String = A_(I).ToString
Dim StringsToCheck As String() = StringToCheck.Split(","c)
For Each S As String In StringsToCheck
'0 1 2
'0 2 1
'1 2 0
'1 0 2
'2 0 1
'2 1 0
Dim StringsToFind As String() = {S(0) & S(1) & S(2),
S(0) & S(2) & S(1),
S(1) & S(2) & S(0),
S(1) & S(0) & S(2),
S(2) & S(0) & S(1),
S(2) & S(1) & S(0)}
For J As Integer = 0 To StringsToFind.Count - 1
Me.TextBox3.AppendText(StringsToFind(J) & vbCrLf)
Dim Count As Integer = 0
For Each Check As String In B_
If Check.Contains(StringsToFind(J)) Then Count += 1
Next
TextBox4.AppendText(StringsToFind(J) & "=" & Count & vbCrLf)
Next
TextBox4.AppendText(vbCrLf)
Next
Next
End Sub
End Class
Continue reading...
sorry re-post back pevious question.Just for learning vb and very sorry about uncomfortable.
Hope somebody correct this code.
I try explain again what I try to do
1. List A_("768")
Make combination in first line "786,687,678,876,867"
2. List A_("836")
Make combination in second line "863,368,386,683,638"
3. List B_.Having 3 digit
First line B_ ;
"613,613,633,133,305,300,350,050,654,653,643,543,161,166,116,616,392,393,323,923,834,835,845,345,201,542,"
second line B_ ;
"635,638,658,358,142,142,122,422,694,696,646,946,429,427,497,297,824,822,078,242,543,547,201,437,386,411,"
4.I want to find all combination in first line List A_in first line List B_ and then find all combination in second line List A_in second line List B_
5. Output in textbox4 is
768=0
786=0
687=0
678=0
876=0
867=0
result first line=0
836=0
863=0
368=0
386=1
683=0
638=1
result first line=2
Option Strict On
Option Explicit On
Imports System.IO
Imports System.Data
Imports System.Text
Public Class Form1
Dim A_ As New List(Of String)
Dim B_ As New List(Of String)
Dim C_ As New List(Of String)
Dim D_ As New List(Of String)
Dim A1_ As New List(Of String)
Dim B1_ As New List(Of String)
Dim C1_ As New List(Of String)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
A_.Add("768")
A_.Add("836")
For I As Integer = 0 To A_.Count - 1
TextBox1.AppendText(A_(I) & vbCrLf)
Next
B_.Add("613,613,633,133,305,300,350,050,654,653,643,543,161,166,116,616,392,393,323,923,834,835,845,345,201,542,")
B_.Add("635,638,658,358,142,142,122,422,694,696,646,946,429,427,497,297,824,822,078,242,543,547,201,437,386,768,")
For I As Integer = 0 To B_.Count - 1
TextBox2.AppendText(B_(I) & vbCrLf)
Next
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
For I As Integer = 0 To A_.Count - 1
Dim StringToCheck As String = A_(I).ToString
Dim StringsToCheck As String() = StringToCheck.Split(","c)
For Each S As String In StringsToCheck
'0 1 2
'0 2 1
'1 2 0
'1 0 2
'2 0 1
'2 1 0
Dim StringsToFind As String() = {S(0) & S(1) & S(2),
S(0) & S(2) & S(1),
S(1) & S(2) & S(0),
S(1) & S(0) & S(2),
S(2) & S(0) & S(1),
S(2) & S(1) & S(0)}
For J As Integer = 0 To StringsToFind.Count - 1
Me.TextBox3.AppendText(StringsToFind(J) & vbCrLf)
Dim Count As Integer = 0
For Each Check As String In B_
If Check.Contains(StringsToFind(J)) Then Count += 1
Next
TextBox4.AppendText(StringsToFind(J) & "=" & Count & vbCrLf)
Next
TextBox4.AppendText(vbCrLf)
Next
Next
End Sub
End Class
Continue reading...