Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have 2 texboxes and 1 button

TextBoxSearch.Text;

TextBoxName.Text;

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 ,
C#
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
Updated 21-Nov-12 15:47pm
v2
Comments
Sergey Alexandrovich Kryukov 21-Nov-12 18:58pm    
Not a question. Not informative. You code does next to nothing. What's the problem?
--SA
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.

C#
public Form1()
    {
        InitializeComponent();
    }
    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());
            tempList.Add(t);
        }
    }

    private void searchbutton_Click(object sender, EventArgs e)
    {
        int index = Convert.ToInt32(TextBoxSearch.Text);
        var n = tempList[index];
        TextBoxName.Text = n.Name;
    }
}
 
Share this answer
 
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.
 
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