Help needed in comapring 2 datagrid
i got 2 tables.
Table 1 is the picklist. It have 2 column which are item name and quantity.
Table 2 is the masterlist. It also have 2 columns which are item name and quantity too.
Masterlist is the table that shows how much inventories i have and picklist is the table that shows how much items i need to draw.
what i need to do is to show that if picklist item quantity is more then masterlist item, then it will appear red on the picklist datagrid.
can any1 help me with this?
Code:
Imports System.IO
Imports System.Data.SqlServerCe
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If AppDatabase1DataSet2Util.DesignerUtil.IsRunTime Then
'TODO: Delete this line of code to remove the default AutoFill for 'AppDatabase1DataSet2.Masterlist'.
End If
'TODO: This line of code loads data into the 'AppDatabase1DataSet1.EPCcode' table. You can move, or remove it, as needed.
'Me.EPCcodeTableAdapter.Fill(Me.AppDatabase1DataSet1.EPCcode)
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Try
Me.PicklistTableAdapter.Fill(Me.AppDatabase1DataSet.Picklist, ComboBox1.Text)
Catch ex As Exception
End Try
End Sub
Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub PictureBox1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub PictureBox2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cn As SqlCeConnection
Dim dirinfo As New DirectoryInfo("\program files\deviceapplication1\RFID")
Dim files() As FileInfo = dirinfo.GetFiles("*")
Dim str As String
Try
cn = New SqlCeConnection("Data Source = \program files\deviceapplication1\AppDatabase1.sdf")
cn.Open()
Dim cmd As SqlCeCommand = cn.CreateCommand()
cmd.CommandText = "UPDATE Masterlist SET Available = 0"
cmd.ExecuteNonQuery()
Dim i As Integer = files.Length
For y As Integer = 0 To i - 1
str = files(y).Name.Substring(0, 24)
cmd.CommandText = "UPDATE Masterlist SET Available = 1 WHERE Masterlist.EPC = '" & str & "'"
cmd.ExecuteNonQuery()
Next
Dim ds As New Data.DataSet
Dim daFac As New SqlCeDataAdapter("SELECT Item, COUNT(Item) AS Qty FROM Masterlist WHERE Available = 1 GROUP BY Item", cn)
daFac.Fill(ds, "Masterlist")
MasterlistBindingSource.DataSource = ds
cn.Close()
Catch ex As Exception
If Picklist.item >= Masterlist.item Then Text = Color.Red
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ComboBox1.Enabled = False
Button2.Visible = False
Button3.Visible = True
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
ComboBox1.Enabled = True
Button3.Visible = False
Button2.Visible = True
End Sub
Private Sub DataGrid2_CurrentCellChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
End Sub
Private Sub DataGrid2_CurrentCellChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid2.CurrentCellChanged
End Sub
End Class