Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Search Results (Win Forms 2.0)

Posted on 2006-07-21
2
Medium Priority
?
203 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 1500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

886 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