datagridview/delegates

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




I am learning vb.net but having trouble with this....:
Essentially, I have 2 datagridview's on 2 different forms. I want one
of the datagridviews to change based on what the user clicks of the
other one..

On the form which the user is clicking I have this:

Private Sub dgvSkuView_CellClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles
dgvSkuView.CellClick
Dim irow As Integer
Dim Skup As Integer
Dim del As frmSkuData.SkuChange
irow = dgvSkuView.CurrentRow.Index
dgvSkuView.CurrentCell = dgvSkuView(4, irow)
Skup = dgvSkuView.CurrentCell.Value
del = New frmSkuData.SkuChange(AddressOf
frmSkuData.ProcessSkuChange)
del.Invoke(Skup)
End Sub


And the on the form I want to change I have this

Public Delegate Sub SkuChange(ByVal value As Integer)

Public Sub ProcessSkuChange(ByVal Value As Integer)
Dim skut As Integer
skut = Value
Dim dv As New DataView
Dim SQL As String = "SELECT * FROM tblSkuData WHERE sku = " &
skut & ";"
Dim Con As OleDb.OleDbConnection = New
OleDb.OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;Data
Source=C:\Argus\ArgusMain.mdb;")
Dim da As OleDb.OleDbDataAdapter = New
OleDb.OleDbDataAdapter(SQL, Con)
Dim ds As New DataSet
da.Fill(ds, "skudata")
dv.Table = ds.Tables("skudata")
Me.dgvSkuData.DataSource = dv
MsgBox(skut)

End Sub


The message box at the end shows the correct value, but the
datagridview itself doesn't do anything..

This might be the completely wrong way to go about this... any
suggestions?


--
mike604
------------------------------------------------------------------------
mike604's Profile: http://www.hightechtalks.com/m289
View this thread: http://www.hightechtalks.com/t363665

.



Relevant Pages