3 Replies Latest reply on May 17, 2016 4:00 AM by Artem Taturevych

    Selected Item is Not Showing in ComboBox(VB.net)

    Suresh Vijayan

      Hi,

      Currently i working on windows form application,i am new to VB.net. Thus i changed the datagrid cell into ComboBox Cell i add itms to that comboBox cell programatically.While Complies the program comboBox Show the items which i added but i selected anyone of them means its not displaying on the combobox,herewith i given my used code & Images for better understanding below Kindly help me to solve this problem.

        ################################################# USED CODE ##########################################################

      '//======DataGrid Cell As ComboBox Cell=========

       

              Dim comboBoxCell As New DataGridViewComboBoxCell

              Dim ComboTypeOfTool As New DataGridViewComboBoxCell

              '//======Operation=====

              comboBoxCell.Items.Add("Reaming")

              comboBoxCell.Items.Add("Tapping")

              comboBoxCell.Items.Add("Boring")

              comboBoxCell.Items.Add("Drilling")

       

              '//======Type Of Cutting Tool=====

              ComboTypeOfTool.Items.Add("Carbide")

              ComboTypeOfTool.Items.Add("HSS")

              ComboTypeOfTool.Items.Add("PCD")

              ComboTypeOfTool.Items.Add("CBN")

       

       

              '//==Specifies The Row Index & Coloumn Index==

              DataGridView1.Rows(0).Cells(3) = comboBoxCell

              DataGridView1.Rows(0).Cells(2) = ComboTypeOfTool

              '//==============================================================

          End Sub

      #######################################################################################################################

      In First Image i selecting the combo box cell in data grid it shows the Options which i added

       

      Pic 1 combo.jpg

      In Second Image i selecting the one item which displaying initially

       

      Pic 2 Combo.jpg

      In this Last  Image Previously selected is not showing when i clicked another cell

      Pic 3 Combo.jpg

       

      Thanks & Regrads

      SureshKumar

        • Re: Selected Item is Not Showing in ComboBox(VB.net)
          Deepak Gupta

          Could you attach the project file to look at and debug?

            • Re: Selected Item is Not Showing in ComboBox(VB.net)
              Suresh Vijayan

              Hi ,

              Sorry i not having permission to copy files from this PC this is Official,

              Else i will Copy the Whole Code Which i used

              #################################################################################################3

               

              Private Sub DataGridView1_CellMouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseClick

               

                      '//======DataGrid Cell As ComboBox Cell=========

               

                      Dim comboBoxCell As New DataGridViewComboBoxCell

                      Dim ComboTypeOfTool As New DataGridViewComboBoxCell

                      '//======Operation=====

                      comboBoxCell.Items.Add("Reaming")

                      comboBoxCell.Items.Add("Tapping")

                      comboBoxCell.Items.Add("Boring")

                      comboBoxCell.Items.Add("Drilling")

               

                      '//======Type Of Cutting Tool=====

                      ComboTypeOfTool.Items.Add("Carbide")

                      ComboTypeOfTool.Items.Add("HSS")

                      ComboTypeOfTool.Items.Add("PCD")

                      ComboTypeOfTool.Items.Add("CBN")

               

               

                      '//==Specifies The Row Index & Coloumn Index==

                      DataGridView1.Rows(0).Cells(3) = comboBoxCell

                      DataGridView1.Rows(0).Cells(2) = ComboTypeOfTool

                      '//==============================================================

                  End Sub

               

              Thanks & Regards

              Suresh