AutoComplete TextBox Search DataBase Table in Windows Application
Window Application Search TextBox Related Keyword Display Database Particular Table Record Display In Window Application.
Auto Suggestion Box Master Page
Auto Suggestion Box Multiple Table Search
Auto Suggestion Ajax AutoCompleteExtender
Auto Complete Search For WINDOW APPLICATION
DEMO
AutoCompleteMode : Get & set control Automatic for Textbox
AutoCompleteSource: Get & set the source of complete String
AutoCompleteCustomSource: Get & set the AutoComplete Source
Property is set to CustomSource
AutoCompleteStringCollection: Get data from Database To allow Bind
to TextBox.
C# Coding
Window Application Search TextBox Related Keyword Display Database Particular Table Record Display In Window Application.
Auto Suggestion Box Master Page
Auto Suggestion Box Multiple Table Search
Auto Suggestion Ajax AutoCompleteExtender
Auto Complete Search For WINDOW APPLICATION
DEMO
C# Coding
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlConnection con;
public void dbcon()
{
con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Drizzle\Documents\Visual Studio 2012\WindowsFormsApplication2\WindowsFormsApplication2\Database1.mdf;Integrated Security=True");
con.Open();
}
private void Form1_Load(object sender, EventArgs e)
{
AutoCompleteStringCollection LocalDataTable = new AutoCompleteStringCollection();
txtAutoComplete.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
txtAutoComplete.AutoCompleteSource = AutoCompleteSource.CustomSource;
txtAutoComplete.AutoCompleteCustomSource = LocalDataTable;
dbcon();
SqlCommand cmd = new SqlCommand("select countryname from country",con);
SqlDataReader rd = cmd.ExecuteReader();
if (rd.HasRows == true)
{
while (rd.Read())
{
LocalDataTable.Add(rd[0].ToString());
}
}
}
}
}
Excellent article and with lots of information. I really learned a lot here. Do share more like this.
ReplyDeleteBenefits Of Web Designing
Advantages Of Web Designing