Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.
Public Function get_Search(ByVal RegNumber As Integer, ByVal chkBoxes As Integer, ByVal indexNumber As Integer, ByVal SearchString As String) Dim sender As System.Object = Me Dim e As System.EventArgs '... the code handles the arguments and sets up the search as if it were the user selecting in the search form.... ' The search is the executed.. btnFind_Click(sender, e) ' In the btnFind_Click procedure, the results are stored in datagridSok. I want to return the ' datagrid or the columns and assign them to another already existing datagrid in another form: Return datagridSok.Columns End Function 'What I have come up with so far is this(done in another form): Private Sub btnTestSok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTestSok.Click dgCustomer.Columns.Clear() Dim tempDataGridViewColumnCollection As System.Windows.Forms.DataGridViewColumnCollection tempDataGridViewColumnCollection = frmSok.get_Search(1, 1, 1, "String") 'The following does not work, I have tried numerous variants... dgCustomer.Columns.Add(tempDataGridViewColumnCollection.Item(1)) End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.