Posted 12 February 2020, 1:26 am EST
Hello,
I was able to view the code, can you please explain what the code is doing.
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim dt As DataTable = New DataTable()
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "ComponentOne Samples\Common\C1NWind.mdb") & ";"
Dim conn As OleDbConnection = New OleDbConnection(connectionString)
Dim adapter As OleDbDataAdapter = New OleDbDataAdapter("Select * from Data", conn)
adapter.Fill(dt)
C1TrueDBGrid1.DataSource = dt
Dim dt1 As DataTable = New DataTable()
adapter = New OleDbDataAdapter("Select * from Data where Qt=1", conn)
adapter.Fill(dt1)
C1TrueDBGrid2.DataSource = dt1
For i As Integer = 0 To C1TrueDBGrid1.Splits(0).Rows.Count - 1
Dim b As Boolean = False
For j As Integer = 0 To C1TrueDBGrid2.Splits(0).Rows.Count - 1
If C1TrueDBGrid1.Columns("Id").CellText(i).ToString = C1TrueDBGrid2.Columns("Id").CellText(j).ToString Then
b = True
Exit For
End If
Next
Dim c As Boolean = False
For j As Integer = 0 To C1TrueDBGrid2.Splits(0).Rows.Count - 1
If C1TrueDBGrid1.Columns("Company").CellText(i).ToString = C1TrueDBGrid2.Columns("Id").CellText(j).ToString Then
c = True
Exit For
End If
Next
Dim d As Boolean = False
For j As Integer = 0 To C1TrueDBGrid2.Splits(0).Rows.Count - 1
If C1TrueDBGrid1.Co
I would like to select the fields to be compared by selecting the code below, instead of hard coding the fields. How do I implement it with your code?
If ComboBox2.SelectedIndex = 0 Then
yx = ""
For Each Srow In Me.DBGrid1.SelectedRows
If vc1 > 0 Then
yx = yx & "," & "'" & Me.DBGrid1.Columns(0).CellText(Srow) & "'"
Else
yx = "'" & Me.DBGrid1.Columns(0).CellText(Srow) & "'"
End If
vc1 = vc1 + 1
If yx.StartsWith(",") Then
yx = yx.Substring(1, yx.Length - 1)
End If
' yx.TrimStart(",")
Next
apply = True
C1AOP5.Refresh()
C1AOP5.FetchRowStyles = True
TextBox9.Visible = True
Panel1.Visible = True
If ccc = 1 Then
ccc = 0
End If
End If
Thanks,
Victor