Click here to Skip to main content
13,197,342 members (52,406 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have 2 texboxes and 1 button



and 1 button(searchbutton)

The thing i want to do is when i press the Search button and type an id in textboxsearch.text ( so the id will get the data and pass it in my textboxname.text

I have written so long ,
var sr=new ServiceReferens1.Product();
//here i have tryed
// TextBoxSearch.Text=sr.ProductID;
// and many more thing have i tryed so i need help!
Posted 21-Nov-12 11:07am
Updated 21-Nov-12 15:47pm
Sergey Alexandrovich Kryukov 21-Nov-12 18:58pm
Not a question. Not informative. You code does next to nothing. What's the problem?
@AmitGajjar 21-Nov-12 21:48pm
you tried so many things but can you post your service code, then only we can answer your question.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

public Form1()
    List<T> tempList = new List<T>();
    class T
        public T()
        public T(int id, string name)
            ID = id;
            Name = name;
        public int ID { get; set; }
        public string Name { get; set; }
    private void Form1_Load(object sender, EventArgs e)
        string str = "abcdef";
        for (int i = 0; i < 6; i++)
            T t = new T(i,str[i].ToString());
    private void searchbutton_Click(object sender, EventArgs e)
        int index = Convert.ToInt32(TextBoxSearch.Text);
        var n = tempList[index];
        TextBoxName.Text = n.Name;
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Call one stored procedure to get the text box name values based on id, so here return type is dataset.

from this dataset assign textbox name to textboxName.text

I hope this will help you.

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 |
Web04 | 2.8.171020.1 | Last Updated 21 Nov 2012
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