I have a form that requires several Comboboxes and TextBoxes when I tried it on one box it works:

Public Class frmStart

    'Code for Combobox Borders
    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()
        ' Add any initialization after the InitializeComponent() call.
        AddHandler Me.Paint, AddressOf DrawComboBlueBorder
    End Sub
    Private Sub DrawComboBlueBorder(ByVal sender As Object, ByVal e As PaintEventArgs)
        Dim rect As New Rectangle(Me.cboCallType.Location.X - 1,
                                  Me.cboCallType.Location.Y - 1,
                                  Me.cboCallType.Width + 2,
                                  Me.cboCallType.Height + 2)

        Dim pen As New Pen(Color.FromArgb(0, 172, 238), 2)
        Dim g As Graphics = e.Graphics
        g.DrawRectangle(pen, rect)
    End Sub

End Class

So I attempted to move it to a Class Library (Which I have never done before) Here is what I have, When I import the control in to my Tools, and use it, I get no border

Imports System.Windows.Forms
Imports System.Drawing
Imports System.EventArgs

Public Class BorderComboBox
    Inherits ComboBox

    Public Sub New()
        AddHandler Me.Paint, AddressOf DrawComboBlueBorder
    End Sub
    Private Sub DrawComboBlueBorder(ByVal sender As Object, ByVal e As PaintEventArgs)
        Dim rect As New Rectangle(Me.Location.X - 1,
                                  Me.Location.Y - 1,
                                  Me.Width + 2,
                                  Me.Height + 2)

        Dim pen As New Pen(Color.Red, 2)
        Dim g As Graphics = e.Graphics
        g.DrawRectangle(pen, rect)
    End Sub
End Class

Like I said, I am just getting in to more advanced stuff, Thanks in advance for any help

The color you are using is coincident or very similar to the one of the border color when the focus is on the control. When there are more than one control just one has the focus. Please, take a look to Click Here

Be a part of the DaniWeb community

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