O'Reilly Forums: Howto: Add A Search Button To The Contact Project In Chapter 1 - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Howto: Add A Search Button To The Contact Project In Chapter 1

#1 User is offline   AndrewStellman 

  • Andrew Stellman
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: O'Reilly Author
  • Posts: 787
  • Joined: 08-October 08
  • Gender:Male
  • Location:Brooklyn, NY
  • Interests:Author of: "Head First C#", "Beautiful Teams", "Head First PMP", "Applied Software Project Management"

Posted 03 September 2010 - 11:41 AM

(NOTE: This applies only to the second edition of Head First C#)
A while back, one of our readers posted a question about adding a search button to the project in chapter 1. I've gotten that question a few times, and while we don't cover it in the book, I thought it was worth coming up with an answer. And luckily, the instructions in that post still work for the second edition, even though we switched from SQL Server Express to SQL Server Compact Edition.

So here are step-by-step instructions for adding a button to your form to filter the results based on search criteria. It does this by setting the RowFilter for the dataset that holds the data retrieved from the database, and then updating the binding source's DataSource to tell it to reload the data from the dataset.

Note that this is a "quick and dirty" solution, but it should work just fine for a straightforward application.

http://forums.oreill..._6685#entry6685
Andrew Stellman
Author, Head First C#
Building Better Software -- http://www.stellman-greene.com
0

#2 User is offline   digitalfriction 

  • New Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 30-March 11

Posted 31 March 2011 - 12:18 AM

View PostAndrewStellman, on 03 September 2010 - 11:41 AM, said:


<a href="http://forums.oreilly.com/content/Head-First-C-/2267/Chapter-1-Project-Question/" target="_blank">http://forums.oreilly.com/content/Head-Fir...oject-Question/</a>


Having only started the book, this topic is relevant to me, but the link is dead?

Anyone have a copy of the instructions?
0

#3 User is offline   AndrewStellman 

  • Andrew Stellman
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: O'Reilly Author
  • Posts: 787
  • Joined: 08-October 08
  • Gender:Male
  • Location:Brooklyn, NY
  • Interests:Author of: "Head First C#", "Beautiful Teams", "Head First PMP", "Applied Software Project Management"

Posted 02 April 2011 - 07:46 AM

It looks like the link changed when the forum software was upgraded. I updated the post with the correct link.
Andrew Stellman
Author, Head First C#
Building Better Software -- http://www.stellman-greene.com
0

#4 User is offline   ranand12 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 23-May 11

Posted 10 June 2011 - 11:54 AM

View PostAndrewStellman, on 02 April 2011 - 07:46 AM, said:

It looks like the link changed when the forum software was upgraded. I updated the post with the correct link.



Is there a way to use the search text box with an autocomplete functionality (querying from the Name's table)?
0

#5 User is offline   MSP005 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 11-July 11

Posted 11 July 2011 - 02:15 PM

View PostAndrewStellman, on 03 September 2010 - 11:41 AM, said:

A while back, one of our readers posted a question about adding a search button to the project in chapter 1. I've gotten that question a few times, and while we don't cover it in the book, I thought it was worth coming up with an answer. And luckily, the instructions in that post still work for the second edition, even though we switched from SQL Server Express to SQL Server Compact Edition.

So here are step-by-step instructions for adding a button to your form to filter the results based on search criteria. It does this by setting the RowFilter for the dataset that holds the data retrieved from the database, and then updating the binding source's DataSource to tell it to reload the data from the dataset.

Note that this is a "quick and dirty" solution, but it should work just fine for a straightforward application.

http://forums.oreill..._6685#entry6685

Attached File(s)


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users