How to Create a Focus and Select Barcode Textbox in the UserControl Form in vb.net

45 Views Asked by At

How to Create a Barcode Focus and Select Textbox in the UserControl Form in vb.net. I've created a select textbox like the code below but it doesn't work and I don't want use form_load so I can only public sub new.

is there something wrong with my code? the problem is that the textbox is not in the select position at the first time the form loads

Namespace project.Pages

    Partial Public Class PgItemTransfer
        Inherits UserControl

        Public Sub New()

            If Program.IsInDesignMode(Me) Then
                Return
            End If

            InitializeComponent()

            ColAvatar.FillWeight = 30.0!
            ColAvatar.Width = 30
            ColEdit.FillWeight = 30.0!
            ColEdit.Width = 46

            LoadData()
            
            BtxtBarcode.Focus()
            BtxtBarcode.Select()
            
        End Sub
0

There are 0 best solutions below