Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 128939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:42:53+00:00 2026-05-11T05:42:53+00:00

I have a search usercontrol that I’d like to make generic. The control itself

  • 0

I have a search usercontrol that I’d like to make generic.

The control itself will contain a different collection of controls dependent on its context. For example it could be stock items, people, address as the context of the search..

How can I make it generic enough that based upon the search context it knows exactly what user controls it needs on the form?

Any programmer can then just drag the user control onto their form, set it’s context and we are good to go.

My first thought is to create a base control for all the individual user controls and the search dialog accepts these in the constructor so it knows which ones to show at runtime. You can create inherited versions of the base controls and pass these in. Or maybe just set the search context (enum) and it showhow works out what the user controls are at runtime.

It’s all .net 2.0 Winform

Edited for readibilty. Q was far too lenghty and detailed before.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:42:53+00:00Added an answer on May 11, 2026 at 5:42 am

    On our project, we did this by adding an ISearchable interface with CanSearch and Search properties. These took a direction argument specifying forwards or backwards, and the Search method also took a string for performing the search and an enumeration specifying the type of matching (start of phrase, end of phrase, included in phrase, etc).

    We then implemented this interface on all controls in a hierarchy. Each control then delegated to the child controls as it saw fit. Our container application would contain a textbox and find next/previous buttons. The container would query the first view in the hierarchy for the interface, which would then chain down to the target control as seen fit by each control in the hierarchy.

    We implemented an alternative approach for our clipboard operations whereby we checked the actively focused control directly first to see if it supported our ISupportEdit interface. If it did not, we then used the hierarchy approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a search program that will be looking at a database from a
I have a Page that has a single instance of a UserControl that itself
I have a Silverlight user control that is a textbox with a search button
I have a search form that offers a number of different search options, such
the div on website below that have search at the bottom and it always
I have a search box that doesn't have a submit button, I need to
I have a UserControl that is part of a Class library. I reference this
I have MainWindow and 2 user controls. In Main Window there is Tab Control
I have search query that has many optional parameters and then search word field
I have a silverlight listbox that is being used as a search result box.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.