none
combobox display RRS feed

  • Question

  • Hi Everyone:

    I am using vb.net 2019.  I have a form with a combobox on it with the style Dropdownlist (see image 1).  Is there a way to have the combobox display like image 2?  Image 2 comes from an old project.  Thank you.

    Bob

    Saturday, July 13, 2019 7:04 AM

Answers

  • Hi,

    Public Class Form1
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox1.FlatStyle = FlatStyle.Popup
            ComboBox1.Items.Clear()
            ComboBox1.Items.Add("1")
            ComboBox1.Items.Add("2")
            ComboBox1.Items.Add("3")
        End Sub
    
    End Class
    


    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 16, 2019 4:27 AM
    Moderator

All replies

  • Hello,

    In the second image, what version of Visual Studio and is the DropDownStyle the same as the first image?


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Saturday, July 13, 2019 9:33 AM
    Moderator
  • That is flat style flat in image2.


            ComboBox1.FlatStyle = FlatStyle.Flat
            


    Saturday, July 13, 2019 9:35 AM
  • Thanks TommyTwoTrain. It is not flat.  The combobox in image2 has a 3D appearance, where as the flat style is completely flat.  Before posting my question, I had played with the FlatStyle.

    Bob

    Saturday, July 13, 2019 4:15 PM
  • Thanks Karen.   The two comboboxes are identical in the two versions of the two images.  Image 2 was created using VS 2010 (or earlier, I can't remember exactly) and obviously, image 1 is created using the new VS 2019.  Now the funny thing is that when I open the old project using VS 2019, it displays it like image 2.  However, when I open the new project (still with VS 2019), it shows like image 1.  Finally, during design time they both display like image 1.  their appearance only changes during run-time.

    Also, when I open the old project with VS 2019, and put in a brand new combobox with the style DropdownList and FlatStyle of Standard, during runtime, the combobox looks like image 2.

    • Edited by booboo_US Saturday, July 13, 2019 5:08 PM
    Saturday, July 13, 2019 4:34 PM
  • Hi,

    Public Class Form1
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox1.FlatStyle = FlatStyle.Popup
            ComboBox1.Items.Clear()
            ComboBox1.Items.Add("1")
            ComboBox1.Items.Add("2")
            ComboBox1.Items.Add("3")
        End Sub
    
    End Class
    


    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 16, 2019 4:27 AM
    Moderator