Solved

Search Results (Win Forms 2.0)

Posted on 2006-07-21
2
198 Views
Last Modified: 2010-04-16

Im building a Search facility and want to return a set of results (Done!)

The results are displayed in a GridView, but I want the user to click a row and then that client info will pop up in the text boxes:

a Sample:

string ConnectionString = "Data Source='db.sdf';";
            SqlCeConnection connection = new SqlCeConnection(ConnectionString);
            connection.Open();
            string strLastName = textBox1.Text;
            string strPostCode = textBox2.Text;
            string strEmail = textBox3.Text;

            if (!(textBox1.Text == null))
            {

                string SelectLastName = "SELECT OID, name, lastname, Postcode, Emailad FROM Eaddress WHERE lastname = '" + strLastName + "'";

                SqlCeDataAdapter da = new SqlCeDataAdapter(SelectLastName, ConnectionString);
                DataSet ds = new DataSet();
                da.Fill(ds, "Eaddress");
                dataGridView1.DataSource = ds;
                dataGridView1.DataMember = "Eaddress";

  }

i have two text boxes called textbox1 and textbox2, when user clicks the row the name appears in textbox and lastname appears in textbox2.

example would help very much!!
0
Comment
Question by:ziwez0
2 Comments
 
LVL 12

Accepted Solution

by:
topdog770 earned 500 total points
ID: 17156712
Had response.. then saw the ce part..

Take a look here.. Michael gives a good description of the gridview events you need and a sample of how to use them.

http://msdn.microsoft.com/vcsharp/programming/columns/wonders/default.aspx?pull=/library/en-us/dnforms/html/winforms02172004.asp


0
 
LVL 1

Expert Comment

by:flashaoy
ID: 17161337
Look up textbox databinding.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question