Solved

Search Results (Win Forms 2.0)

Posted on 2006-07-21
2
195 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Data Saving 5 56
Host asp.net pages 5 26
Connection String 16 43
How can my static class become undefined?? 8 21
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

864 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now