Click here to Skip to main content
15,894,410 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private void purchase_Load(object sender, EventArgs e)
       {
           UGIcon = new SqlConnection(@"Data Source=SELVA-T;Initial Catalog=textile;Integrated Security=True;MultipleActiveResultSets=True;");

           UGIcon.Open();
           cmd = new SqlCommand("SELECT * from purchase", UGIcon);
           SqlDataReader re = cmd.ExecuteReader();
           AutoCompleteStringCollection coll = new AutoCompleteStringCollection();
           while (re.Read())
           {
               coll.Add(re.GetString(1));
           }
           toolStripTextBox1.AutoCompleteCustomSource = coll;
           re.Close();
           UGIcon.Close();
       }

c
This is my autosuggest words in toolstriptextbox coding

if i insert the word "Love" into the DB and enter a letter "L" in toolstriptextbox its not displaying currently inserted word... if i close the application and run again then only its displaying the word "Love" if i type "L"...

In runtime if i add a word to DB it need to be displayed in auto suggestion list...
what i need to do..?
Posted
Updated 18-Jan-13 16:41pm
v3
Comments
Shanu2rick 19-Jan-13 0:03am    
your code is not working as wish to is because your code is written in Load event.
Try it on other event like textchange Event of the textbox and use an update panel that will work.
selva_1990 19-Jan-13 0:07am    
i ll try and tell :)
selva_1990 19-Jan-13 0:19am    
its working thank you :)
Shanu2rick 19-Jan-13 2:30am    
you are welcome :)

 
Share this answer
 
Comments
selva_1990 18-Jan-13 12:56pm    
my code working but its not updating... every time i close and run then its working
[no name] 18-Jan-13 12:57pm    
can you post both code (.aspx & .cs)?
selva_1990 18-Jan-13 13:02pm    
sorry its windows application i have ly (.cs code)
[no name] 18-Jan-13 13:03pm    
you can send designer code and code file
selva_1990 18-Jan-13 13:05pm    
namespace log
{
partial class purchase
{
///
/// Required designer variable.
///

private System.ComponentModel.IContainer components = null;

///
/// Clean up any resources being used.
///

/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.label12 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox();
this.bindingNavigator1 = new System.Windows.Forms.BindingNavigator(this.components);
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.toolStripTextBox1 = new System.Windows.Forms.ToolStripTextBox();
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.textBox10 = new System.Windows.Forms.TextBox();
this.textBox9 = new System.Windows.Forms.TextBox();
this.textBox8 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.bindingNavigator1)).BeginInit();
this.bindingNavigator1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.
Hi Try this

AutoCompleteStringCollection AutoItem = new AutoCompleteStringCollection();
            foreach (DataRow OSAmt in dataSetStockistOutstanding1.OutstandingAmount1)
            {
                AutoItem.Add(OSAmt["CustCode"].ToString());
                AutoItem.Add(OSAmt["CustCompName"].ToString());
                AutoItem.Add(OSAmt["ChequeNo"].ToString());
                AutoItem.Add(OSAmt["InvoiceNo"].ToString());
            }
            Tesearchupdate.AutoCompleteMode = AutoCompleteMode.Suggest;
            Tesearchupdate.AutoCompleteSource = AutoCompleteSource.CustomSource;
            Tesearchupdate.AutoCompleteCustomSource = AutoItem;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900