I have a datagrid on the form bind with recordsets. I need to know if is it possible to assign that datagrid object into a variable?

I have created a preliminary code but its not working

dim dbgridvar as DataGrid

Private Sub Assign_Click()
set dbgridvar=Form1.Datagrid1
End Sub

Thank you for helping!

I can't test this out because I don't have anything older than vb.net 2010 but I don't believe you need the Set keyword. Try just

dbgridvar = Form1.Datagrid1

Are you getting an error message?

thank you Reverend Jim!

It seems that my code is correct but the problem is I have declared it as private in my module and I tried to access it in a form..

Thanks.. Solved!