ComboBox Woes

Begginnerdev 2 Tallied Votes 257 Views Share

Upon resizing an anchored combobox - I noticed the text was always selected.
This sparked the initiative to fix this problem. (Microsoft decided not to)

So by extending the combobox class we can fix this.

The following class can be dropped into a form for designer manipulation or as a user control.

This is an extremely simple fix.

TnTinMN commented: So I'm not the only one to find that iirritating! That dang edit control box! textbox control! +7
JorgeM commented: nice. +12
Public Class ExtendedComboBox
    Inherits ComboBox

    Sub Me_Resize(sender As Object, e As EventArgs) Handles Me.Resize
        If Not Me.Focused Then Me.SelectionLength = 0
    End Sub
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.