While developing application software, representing data in the GUI in friendly and readable format is one of the most important considerations.
In VB.NET application (or Windows/desktop applications), .NET provides Data grid control to achieve the above important and vital consideration. Sometimes while representing data in a data grid control, user wants to edit the details i.e. he/she wants to edit the details through a combo control or a date time picker control etc.
This article below sheds some light in above area i.e. user can add any control based on his/her choice and can use it to edit the details in the data grid.
Load the Grid with details (when the button Load Grid is clicked).
'Establish the connection to the data base and open it
Dim sqlConn As New SqlConnection("Database=****; Server=*****; uid = **; pwd=****") '*-Pass the required details
sqlConn.Open()
'create the sql command object and set its command type to //execute the sql query to get the //results
Dim sc As New SqlCommand()
sc.Connection = sqlConn
sc.CommandType = CommandType.Text
sc.CommandText = "SELECT ControlName,Control,Description FROM t_TestControls"
'create the data set object to be used to fill the data grid //with the data
Dim ds As New DataSet()
'Create the sql adapter that will be used to fill the data //set created above
Dim myReader As New SqlDataAdapter(sc)
myReader.Fill(ds)
'Fill the rows in the grid
Dim i As Integer
For i = 0 To (ds.Tables(0).Rows.Count) - 1
dataTable.LoadDataRow(arrstr, True)
datagrid1(i, 0) = ds.Tables(0).Rows(i).ItemArray(0).ToString()
datagrid1(i, 1) = ds.Tables(0).Rows(i).ItemArray(1).ToString()
datagrid1(i, 2) = ds.Tables(0).Rows(i).ItemArray(2).ToString()
Next i

Add a control to the data grid.
'ADD the below code in the Got focus event of the data grid text box column
' To add any control ,create its object,set its property and add it to the respective column
comboControl = New ComboBox()
comboControl.Cursor = System.Windows.Forms.Cursors.Arrow
comboControl.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown
comboControl.Dock = DockStyle.Fill
comboControl.Items.AddRange(New String(5) {"", "Information Technology", "Computer Science", "Bio Technology", "Electrical Engg"})
'Create the date time picker control to be added and set its properties
Dim dtp As New DateTimePicker()
dtp.Dock = DockStyle.Fill
dtp.Cursor = Cursors.Arrow
'Create the check box control to be added and set its properties
Dim chk As New CheckBox()
chk.Dock = DockStyle.Fill
chk.Cursor = Cursors.Arrow
'Create the radio button control to be added and set its properties
Dim rb As New RadioButton()
rb.Dock = DockStyle.Fill
rb.Cursor = Cursors.Arrow
'Add the controls to the respective columns in the data grid
Dim i As Integer
For i = 0 To dataTable.Rows.Count - 1
'if the data in the first column is date time, add a date time control to the grid
If datagrid1(i, 0).ToString().Equals("DateTime") And Not (hitTestGrid Is Nothing) And hitTestGrid.Row = i Then
datagridtextBox.TextBox.Controls.Add(dtp)
comboControl.SendToBack()
chk.SendToBack()
rb.SendToBack()
dtp.BringToFront()
'if the data in the first column is combo box, add a combo box control to the grid
Else
If datagrid1(i, 0).ToString().Equals("ComboBox") And Not (hitTestGrid Is Nothing) And hitTestGrid.Row = i Then
datagridtextBox.TextBox.Controls.Add(comboControl)
chk.SendToBack()
dtp.SendToBack()
rb.SendToBack()
comboControl.BringToFront()
End If
End If
datagridtextBox.TextBox.BackColor = Color.White
Next i
NOTE : hitTestGrid can be obtained in the mouse down event of the data grid.

For complete source code, please see the attached file.