<br /> <br /> ' ''-------Search records from database<br /> Dim cmds As New SqlCommand<br /> Dim cons As New SqlConnection<br /> <br /> Dim cts As String = "SELECT names,(dept + ' ' + div + ' ' + pos) as dept_div_pos, tel, local FROM directory1 where (names=@names or dept=@dept or div=@div or pos=@pos or tel=@tel or local=@local)"<br /> cons.ConnectionString = "Data Source=192.168.xx.xx;Initial Catalog=information;Persist Security Info=True;User ID=me;Password=cute"<br /> cmds.Connection = cons<br /> cmds.CommandText = cts<br /> cons.Open()<br /> <br /> Try<br /> <br /> If TextBox1.Text = "" Then<br /> MsgBox("Inavalid Input!")<br /> <br /> Else<br /> ' ''-------- codes for textbox that can accept ascii/special characters<br /> Dim param12 As New SqlParameter()<br /> param12.ParameterName = "@names"<br /> param12.Value = TextBox1.Text.Trim()<br /> cmds.Parameters.Add(param12)<br /> Dim param13 As New SqlParameter()<br /> param13.ParameterName = "@dept"<br /> param13.Value = TextBox1.Text.Trim()<br /> cmds.Parameters.Add(param13)<br /> Dim param14 As New SqlParameter()<br /> param14.ParameterName = "@div"<br /> param14.Value = TextBox1.Text.Trim()<br /> cmds.Parameters.Add(param14)<br /> Dim param15 As New SqlParameter()<br /> param15.ParameterName = "@pos"<br /> param15.Value = TextBox1.Text.Trim()<br /> cmds.Parameters.Add(param15)<br /> Dim param16 As New SqlParameter()<br /> param16.ParameterName = "@tel"<br /> param16.Value = TextBox1.Text.Trim()<br /> cmds.Parameters.Add(param16)<br /> Dim param17 As New SqlParameter()<br /> param17.ParameterName = "@local"<br /> param17.Value = TextBox1.Text.Trim()<br /> cmds.Parameters.Add(param17)<br /> <br /> Dim dss As New DataSet<br /> Dim das As New SqlDataAdapter(cmds)<br /> das.Fill(dss, "directory1")<br /> DataGridView1.DataSource = dss<br /> DataGridView1.DataMember = "directory1"<br /> End If<br /> <br /> Catch ex As Exception<br /> MsgBox("Invalid Input")<br /> MessageBox.Show(ex.Message)<br /> <br /> End Try<br /> cons.Close()<br /> <br />
TextChanged
Private Sub TextBox1_TextChanged(sender As Object, _ e As EventArgs) Handles TextBox1.TextChanged ' your code goes here ..... End Sub
Quote:To make a new TextChanged event, open Visual Studio—and follow these steps. Click on the TextBox and focus it to see the correct designer UI. On the right bottom, you should see the Properties pane. Look for the lightning bolt icon in the pane. After you find the lightning bolt, click on it. Scroll down to where the word TextChanged appears. Double-click in the space next to the TextChanged label.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)