A search module in c#

  • Thread starter Thread starter Hemang
  • Start date Start date
H

Hemang

Hello

I need to create a search form which allows the user to search for records
using multiple criteria, and then they can select that record and when
clicked ok, that particular record to be displayed in the main form.

I have the main form, I need to implement the search feature for that (its a
windows based app).

Any samples would be very helpful.

Thanks
 
You could:

Use a combo for search criteria;
Use a textbox for search string;
Use a button to fire the search;
Use a parameterized query to retrieve the results -or- use multiple queries
depending upon the criteria selected in the combo;
Use a listbox for a listing of the records retrieved, with the primary key
as the valuemember;
When the user clicks on the record desired, use the primary key to retrieve
the details of the record;
Display the detail results in the controls on your form.
 
If you want to display the details on the main form, there are many ways to
do that.

You can create public properties on your main form for those settings, and
set them from your search form.

You can pass an instance of the main form into the search form, and put the
data anywhere in the main form you want to.

When I did this, I actually closed my main form and brought up the search
form. I didn't want them mucking around with the main form anyway. Then
when they return to the main form, I instantiate it and pass in the
information (you could use a structure or class or string if there's only
one field) and then show it. So my main form has a default constructor, as
well as one that takes input(s).

Robin S.
--------------------------
 
Thank you Earl & Robin

Both of your explanation are helpful. However although in theory these
concepts sounds excellent to work, I don't have the skills to code that in
c#, and thus was looking for a live example which I can learn from and
implement in my app. (Finishing an old project which I had undertaken,
coding is not my primary skill set)

Thanking you in anticipation.
..
 
Thanks Earl & RobinS

Although the theory does indeed help, I don't have the skill set to put that
into c# code. I had written the app in c# a while back and now I need to
implement a search module, and thus the request for a sample app, by which I
can look & learn.

Thanking in anticipation.
 
Back
Top