title: Combobox in vb.net datagridview not showing value first time
body: <p>Following is my code:</p>
  
  <pre><code>    Public Class Form1
  
  Private DT_LocalTransactionList As DataTable
  
  Private Sub DataGridView1_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEnter
      DT_LocalTransactionList = New DataTable
      DT_LocalTransactionList.Columns.Add("TransactionName")
      DT_LocalTransactionList.Columns.Add("TransactionType")
      For iVisible As Integer = 0 To 5
          DT_LocalTransactionList.Rows.Add()
          DT_LocalTransactionList.Rows(iVisible).Item("TransactionName") = "Name " &amp; iVisible
          DT_LocalTransactionList.Rows(iVisible).Item("TransactionType") = "Add " &amp; iVisible
      Next
      If e.ColumnIndex = colName.Index Then
          Dim dgvCbo As New DataGridViewComboBoxCell
          dgvCbo = TryCast(DataGridView1(colName.Index, e.RowIndex), DataGridViewComboBoxCell)
          dgvCbo.DataSource = DT_LocalTransactionList
          dgvCbo.DisplayMember = "TransactionName"
          dgvCbo.ValueMember = "TransactionType"
      End If
  End Sub
  
  Private Sub DataGridView1_EditingControlShowing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
      Select Case Me.DataGridView1.CurrentCell.ColumnIndex
  
          Case colName.Index
              If TypeOf e.Control Is ComboBox Then
                  Dim cb As ComboBox = TryCast(e.Control, ComboBox)
                  cb.DropDownStyle = ComboBoxStyle.DropDown
                  cb.AutoCompleteSource = AutoCompleteSource.ListItems
                  cb.AutoCompleteMode = AutoCompleteMode.Suggest
                  RemoveHandler cb.DrawItem, AddressOf GridCombo_DrawItem
                  RemoveHandler cb.DropDownClosed, AddressOf cbDropDownClosed
                  RemoveHandler cb.Validating, AddressOf GridCombo_Validating
                  RemoveHandler cb.KeyDown, AddressOf GridCombo_KeyDown
                  AddHandler cb.DrawItem, AddressOf GridCombo_DrawItem
                  cb.DrawMode = DrawMode.OwnerDrawFixed
                  AddHandler cb.DropDownClosed, AddressOf cbDropDownClosed
                  AddHandler cb.Validating, AddressOf GridCombo_Validating
                  AddHandler cb.KeyDown, AddressOf GridCombo_KeyDown
              End If
      End Select
  End Sub
  
  Private Sub GridCombo_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs)
      Dim text As String = sender.GetItemText(sender.Items(e.Index))
  
      e.DrawBackground()
  
      Using br As New SolidBrush(e.ForeColor)
          e.Graphics.DrawString(text, e.Font, Brushes.Black, e.Bounds)
      End Using
  
      e.DrawFocusRectangle()
  End Sub
  
  Private Sub cbDropDownClosed(ByVal sender As Object, ByVal e As System.EventArgs)
  
  End Sub
  
  Private Sub GridCombo_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
      Dim cb As ComboBox = TryCast(sender, ComboBox)
  
      If Not IsItemExistInList(cb) Then
          e.Cancel = True
      End If
  End Sub
  
  Private Sub GridCombo_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
      Dim cb As ComboBox = TryCast(sender, ComboBox)
      cb.Refresh()
  
      If e.KeyCode = Keys.Enter Then
          If IsItemExistInList(cb) Then
              System.Windows.Forms.SendKeys.Send("{TAB}")
          End If
      End If
  End Sub
  
  Public Function IsItemExistInList(ByRef cboCombo As ComboBox) As Boolean
      Dim blnContinue As Boolean
      Dim intCount As Integer
  
      blnContinue = False
  
      If cboCombo.Text.Trim = "" Then
          blnContinue = True
      End If
  
      If blnContinue = False Then
          For intCount = 0 To cboCombo.Items.Count - 1 And blnContinue = False
              If cboCombo.Text.Trim = cboCombo.GetItemText(cboCombo.Items(intCount)).Trim Then
                  blnContinue = True
              End If
          Next
      End If
  
      IsItemExistInList = blnContinue
  End Function
  
     End Class
  </code></pre>
  
  <p>When I type 'n' in the combobox control of datagridview then it shows all the values from Autocomplete feature, then selecting one and pressing tab it does not show the selected value in that field. When second time doing the same thing it shows correct selection there. How to implement that thing in first time?</p>