Click here to Skip to main content
12,997,190 members (75,918 online)
Rate this:
Please Sign up or sign in to vote.
See more:
private void purchase_Load(object sender, EventArgs e)
           UGIcon = new SqlConnection(@"Data Source=SELVA-T;Initial Catalog=textile;Integrated Security=True;MultipleActiveResultSets=True;");

           cmd = new SqlCommand("SELECT * from purchase", UGIcon);
           SqlDataReader re = cmd.ExecuteReader();
           AutoCompleteStringCollection coll = new AutoCompleteStringCollection();
           while (re.Read())
           toolStripTextBox1.AutoCompleteCustomSource = coll;

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 18-Jan-13 6:42am
Updated 18-Jan-13 16:41pm
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 :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

selva_1990 18-Jan-13 12:56pm
my code working but its not updating... every time i close and run then its working
MaulikDusara 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)
MaulikDusara 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
/// <summary>
/// Required designer variable.
private System.ComponentModel.IContainer components = null;

/// <summary>
/// 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))

#region Windows Form Designer generated code

/// <summary>
/// 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);
// tabControl1
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
selva_1990 18-Jan-13 13:08pm
i cant add full designer code its telling server busy
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Hi Try this

AutoCompleteStringCollection AutoItem = new AutoCompleteStringCollection();
            foreach (DataRow OSAmt in dataSetStockistOutstanding1.OutstandingAmount1)
            Tesearchupdate.AutoCompleteMode = AutoCompleteMode.Suggest;
            Tesearchupdate.AutoCompleteSource = AutoCompleteSource.CustomSource;
            Tesearchupdate.AutoCompleteCustomSource = AutoItem;

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170622.1 | Last Updated 19 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100