By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,578 Members | 1,786 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,578 IT Pros & Developers. It's quick & easy.

Pass parameter back to datagrid from one form to another form

P: n/a

Can anyone help me with this problem. I've a form1(entry form) with datagrid
which bound to a dataset (datagrid.setdatabinding(dataset,"table")). I've a
public class Capturekey in form1 which capture key entered in the datagrid
cell. I've another form2(product code form) which has a listview display
product code.

My problem is how can I pass the product code and product description in
form2 back to form1 datagrid current cell.

I manage to get the datagrid currentcell row and column with following code.
datagrid.currentcell.rownumber() and datagrid.currentcell.columnnumber()

I've created a Public Sub AssignValue() in form1 with following clode.
Public Sub AssignValue()
datagrid.currentcell.columnnumber) = "test"
End Sub

In Public Class Capturekey, I've the following code.
Public Class Capturekey
dim newform1 as new form1
end class

However, I got the following error, "Data cannot be read from a DataGrid
which is not bound to a DataTable". Though the datagrid current row and
column have value example 1.

If I run the Public Sub AssignValue() in form1, not from other class like
Public Class Capturekey, I can assign the value to the datagrid current cell
successfully. I think the problem is the Public Sub New() in #Region
"Windows Form Designer generated code" in form1 will always run when I
declare Dim newform as new form1.

Now I've 3 classes. I try not to merge form1 with Public Class Capturekey
code because I would like to reuse Public Class Capturekey. Any better
solution will be very appreciated. Pls help. Thanks

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.