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!

Recommended Answers

All 2 Replies

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.