Click here to Skip to main content
13,248,766 members (57,363 online)
Click here to Skip to main content
Add your own
alternative version


20 bookmarked
Posted 22 Oct 2005

Build lookup control using visual studio 2005

, 22 Oct 2005
Rate this:
Please Sign up or sign in to vote.
Custom editors in building user controls

Sample Image - LookupScreenShot.jpg


In this article I tried to illustrate how it's easy to develop custom user control with different types of property editors and how to make custom data binding property in visual studio 2005 beta and visual c#

<?xml:namespace prefix = o /><o:p> 

While building this control, I tried to be as close as possible to the MVC (Model / View / Controller) pattern

Control Model


All the selection statement are based on the INFORMATION_SCHEMA system view, so that I can gain full compliance with Sql Server 2000 and Sql Server 2005


Drop Down Editors


We only need to specify UITypeEditorEditStyle.DropDown in the edit style override


I had a problem that I needed to access another property of the user control ( The Sql Connection already defined by developer) , I found a very handy reference which is context.Instance which I got it in edit value override , that I casted to my user control class 

Modal Dialog Editor

Just specify UITypeEditorEditStyle.Modal in the edit style override , the control illustrates that you can easily embed any form as your dialog in Visual Studio




Developer should specify the SqlConnection property , then the table name , optionally he/she has to specify the table schema ( used heavily in Adventure Works sample database that shipped with Sql Server 2005 Beta ) , finally he has to select the columns that appear to the users in the lookup dialog




Thanks to the article "Creating Custom Controls-Providing Design Time Support 1 " By Kodanda Pani as it was a good starting point for me




Initial version on 22-10-2005



This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Waleed Zedan
Web Developer
Egypt Egypt
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralMy vote of 2 Pin
span23728-Mar-10 13:17
memberspan23728-Mar-10 13:17 
GeneralLookup control Pin
markop21-Oct-07 0:46
membermarkop21-Oct-07 0:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171114.1 | Last Updated 22 Oct 2005
Article Copyright 2005 by Waleed Zedan
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid