Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a search button on a form

Status
Not open for further replies.

tonygr

Technical User
Jan 20, 2005
42
GB
Hi all,

I am using vs 2005, sql server 2000.
Firstly sorry for the newbie question

I have created a form with a datagridview from a table called tblMembers. when the form opens it displays the data from the table.

I would like to search for a record using a textbox & button. If possible also to select the column in which to search using a combobox or somthing. all fields are a string value that I would want to search i.e. memberID or Surname, you get the drift (I hope!!!)

I have had a good look on the forum and can find a few examples of searching features, but being a newbie I am unable to apply them to my form.

any help or pointers would be greatly appreciated

regards
Tony
 
Add a combobox too. Depending on the item that you select, there will be a string, which will be the name of the column (save the exact ame of the column as each item's value). Then when you hit the search button, loop through all rows of the dgv, and use the column name from the combobox.selectedvalue.

It is easy.
Do you have any problems?
 
Hi TipGiver Thanks for the reply.

Unfortnatley as stated above complete novice!

is there any sample code available that you could point me to?

all I have done is to place the textbox, and button along side the datagridview on the form.

any help or tips on where to search for a tutorial would be great also.

Thanks again
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top