Hi,
I apologise if this is a little basic however my knowledge of programming is fairly none existent. Basically what im doing is selecting some search critera with one form and with a second form i want the results to load in a datagrid when the button is selected on the first form. I have managed to get the data to load on the first form in a datagrid as a test so i know that it all works. The problem i am having is passing the dataset to form 2 to pick up and load in the datagrid. Would anybody know a way of doing this that is fairly simple to implement. I have included to code below to show how i have initiated the data etc.
thanks for any help
johnuk4
Code:SQLStr = "SELECT Hardware_Problems.Hardware_Problem_Id, Hardware.Hardware_Type, Hardware.Hardware_Make, Hardware.Hardware_Model, Hardware_Problems.Date_Time, Hardware_Problems.Staff_Reported, Hardware_Problems.Problem_Description, Hardware_Problems.Location FROM Hardware INNER JOIN Hardware_Problems ON Hardware.Hardware_Id = Hardware_Problems.Hardware_Id;" DatabaseTable = "Hardware_Problems" Case Is = "All Other Problems" Case Is = "In Location" 'msgbox for if user hits search without selecting an input Case Else MsgBox("Please select search criteria", MsgBoxStyle.OKOnly, "Error") End Select With dbAdaptr .TableMappings.Add("Table", DatabaseTable) SQLCode = SQLStr SQLStr = SQLCode cmd = New System.Data.OleDb.OleDbCommand(SQLStr, DBCon) cmd.CommandType = CommandType.Text .SelectCommand = cmd .Fill(DSet) .Dispose() End With DSet.AcceptChanges() DSet.Dispose() DBCon.Close() DataGrid1.SetDataBinding(DSet, DatabaseTable) ProgressBar1.Value = 100 End Sub




Reply With Quote