The following code sample can be used for to select the all text word in the single click. Continue reading “Make full select the text on the single click in text area”
Search Textbox with dropdown in vb.net
you can create a drop-down textbox somthing like Auto suggest Google search. when will you type a letter to this textbox then it will show the words starting with letter in drop down.
Let’s suppose if you type ‘a’ into textbox then textbox will suggest all words starting with letter ‘a’ in drop down.
You can do this with the help of AutoCompleteMode property in Textbox control. This property automatically matches the input string. This property is very useful for frequently searching strings. If there is duplication occurs in source data then the AutoCompleteMode property omits the duplication and display only once. We need to use AutoCompleteMode and AutoCompleteSource property must be used together.
In the following example textbox control named TextBox1 suggest us employee names from the database according to input string(like picture)
Private Sub FillSearchResult() Dim AutoComp As New AutoCompleteStringCollection() Dim dsSerch As New DataSet Dim ConStr As String = "user id=sa;password=aeiouy;Initial Catalog=......." Dim sqlCon As New SqlClient.SqlConnection(ConStr) sqlCon.Open() Dim Str As String = "select empname from tbl_Employee" Dim SqlCom As New SqlClient.SqlCommand(Str, sqlCon) Dim sqlAdap As New SqlClient.SqlDataAdapter(SqlCom) sqlAdap.Fill(dsSerch) For i As Integer = 0 To dsSerch.Tables(0).Rows.Count - 1 AutoComp.Add(dsSerch.Tables(0).Rows(i)(0).ToString()) Next TextBox1.AutoCompleteMode = AutoCompleteMode.Suggest TextBox1.AutoCompleteSource = AutoCompleteSource.CustomSource TextBox1.AutoCompleteCustomSource = AutoComp End Sub
Drag and drop from treeview to textbox in vb.net
Drag and drop operation is the same as cut and paste (or copy and paste) through the mouse instead of the keyboard.
Continue reading “Drag and drop from treeview to textbox in vb.net”
How to change Textbox font at runtime using vb.net
Following example shows how to change font of the textbox at runtime in vb.net
Continue reading “How to change Textbox font at runtime using vb.net”
Character casing in Textbox control
You can use the CharacterCasing property of the TextBox control in .net to change the case of characters as required by your application. For example,
you could change the case of all characters entered in a TextBox control used for username and password. When user can enter some textbox in both textbox, these textbox automatically change the text into upper case.
This example requires two textbox (txtUsername, txtPassword) and one button(see in the picture).
we can set the CharacterCasing property of the TextBox control through designer window as well as code.
txtUsername.CharacterCasing = CharacterCasing.Upper txtPassword.CharacterCasing = CharacterCasing.Upper
txtUsername.CharacterCasing = CharacterCasing.Upper; txtPassword.CharacterCasing = CharacterCasing.Upper;
Create dynamic Textbox and Label in vb.net
In this article we will learn how to create TextBox and Label control at run time in vb.net.
There are many situations in windows application development when we need to create windows controls at run time.
The following example shows how to create and add controls to group box(create textbox and label control in groupbox dynamically).
Continue reading “Create dynamic Textbox and Label in vb.net”