I have a form that displays a datagridview based upon selection made in a combo box. The datagridview uses a stored procedure to retrieve data and the combobox value is given as a parameter for the stored procedure. I instatiate and bind the datagrid via code in the leave event of the combobox. It works fine on the initial value but I want the datagrid to update when the combox value changes. Below is the code for the leave event of the combobox. I am using a tag as a flag to see if I have instantiated the grid or not.
How do I make the datagrid update after the combobox selection changes?
If Me.txtDescription.Tag = "0" Then
adpModel = New SqlDataAdapter
cmdGetModel = New SqlCommand("SW_GET_PROC_MODEL", dbConn)
dsModel = New DataSet
dgvModel = New DataGridView
.CommandType = CommandType.StoredProcedure
adpModel.SelectCommand = cmdGetModel
.DataSource = dsModel.Tables("MODEL")
.Location = New Point(15, 67)
.Size = New Size(585, 158)
Me.txtDescription.Tag = "1"
cmdGetModel.Parameters("@PROCESS_ID").Value = Me.cboProcID.Text