Jump to content


Photo

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


  • Please log in to reply
4 replies to this topic

#1 AndrewStellman

AndrewStellman

    Andrew Stellman

  • O'Reilly Author
  • PipPipPipPipPipPipPipPipPipPipPip
  • 828 posts
  • 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

#2 digitalfriction

digitalfriction

    New Member

  • Members
  • Pip
  • 2 posts

Posted 31 March 2011 - 12:18 AM

<a href="http://forums.oreill...ject-Question/" target="_blank">http://forums.oreill...t-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?

#3 AndrewStellman

AndrewStellman

    Andrew Stellman

  • O'Reilly Author
  • PipPipPipPipPipPipPipPipPipPipPip
  • 828 posts
  • 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

#4 ranand12

ranand12

    New Member

  • Members
  • Pip
  • 1 posts

Posted 10 June 2011 - 11:54 AM

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)?

#5 MSP005

MSP005

    New Member

  • Members
  • Pip
  • 1 posts

Posted 11 July 2011 - 02:15 PM

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.oreilly.com/topic/2267-chapter-1-project-question/page__p__6685#entry6685

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users