Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# SQL-Server
 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 18-Jan-13 6:42am
Edited 18-Jan-13 16:41pm
v3
Comments
Shanu2rick at 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 at 19-Jan-13 0:07am
   
i ll try and tell :)
selva_1990 at 19-Jan-13 0:19am
   
its working thank you :)
Shanu2rick at 19-Jan-13 2:30am
   
you are welcome :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
selva_1990 at 18-Jan-13 12:56pm
   
my code working but its not updating... every time i close and run then its working
MaulikDusara at 18-Jan-13 12:57pm
   
can you post both code (.aspx & .cs)?
selva_1990 at 18-Jan-13 13:02pm
   
sorry its windows application i have ly (.cs code)
MaulikDusara at 18-Jan-13 13:03pm
   
you can send designer code and code file
selva_1990 at 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.
selva_1990 at 18-Jan-13 13:08pm
   
i cant add full designer code its telling server busy
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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;
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 547
1 Member 11120668 188
2 ChauhanAjay 180
3 Maciej Los 165
4 CHill60 135
0 Sergey Alexandrovich Kryukov 9,735
1 OriginalGriff 6,987
2 CPallini 5,835
3 George Jonsson 4,017
4 Gihan Liyanage 3,266


Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 19 Jan 2013
Copyright © CodeProject, 1999-2014
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