

SqlConnection conn = new SqlConnection() Private void frmAuto_Load( object sender, EventArgs e) AutoCompleteCustomSource - this is the collection we created earlierĬonfigurationManager.AppSettings ĪutoCompleteStringCollection namesCollection = AutoCompleteSource - this needs to be set as Custom Sourceģ. AutoCompleteMode - we can choose either suggest or appned or suggestappend as names are self explanatoryĢ. AutoComplete textBox by fetching the data from database.įor this i've created a database with a table containing names which will be shown in textbox as suggestions, for this we need to create a AutoCompleteStringCollection and then add the records in this collection using datareader to fetch records from databaseįor autocomplete functionalty to work we need to define these 3 properties of textboxġ. TextBox1.AutoCompleteCustomSource = autoComplete Ģ. TextBox1.AutoCompleteSource = AutoCompleteSource.CustomSource TextBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend Private void Form1_Load( object sender, EventArgs e) Private void button1_Click( object sender, EventArgs e) ĪutoCompleteStringCollection autoComplete = new AutoCompleteStringCollection()
#C# write to textbox code
This code is not working i know problem is in my main page but i don't know how can i solve this problem please help me. Txtboxpartyidquant.Text = (beobj.party_id.ToString()) Public SqlDataReader autofillquantity(BEL beobj) *//command for autofill data into table quantity. SqlDataReader sdr = cmd.ExecuteReader(CommandBehavior.CloseConnection) Public SqlDataReader autofillparty_id(BEL beobj)Ĭmd = new SqlCommand("select * from product where prod_id='" + beobj.prod_id + "'", con) Ĭmd.CommandType = CommandType.StoredProcedure command for auto fill data into quantity table SqlConnection con = new SqlConnection("Data Source=CBP\\SQLEXPRESS Initial Catalog=ECG Integrated Security=True") Ĭmd.CommandText = "select * from Table2 where first=" + () ĭa = new SqlDataAdapter("select * from Table2", con) Private void button1_Click(object sender, EventArgs e)

This is the error Conversion failed when converting the varchar value 'f' to data type int. what i need is wen i enter in "first" textbox and hit the button search,for the remaining textboxs like middle & last the data has to be retrived into it.Now its giving error saying cannot convert varchar to int.I had given datatype as for all the fields in database as "varchar(50)". And now i created in database three fields called first,middle,last also i gave values for those fields.
#C# write to textbox windows
I created in windows application,one form in that i had created three labels (first,middle,last) & infront of that i created textboxes with Search button in bottom.

I was using my way,but i made a slight change according to you,even though it is not retriving.
