473,691 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to display/populate a property of a custom control with a dropdown style

Hello,

I have written my own custom control and I want one of its properties to
display as a dropdown list when clicked, so the user can select from the
list, it would be similar to the asp textbox control which has a 'TextMode'
property and when clicked on, displays as a dropdown list with 3 values, I
want to have a similar type property with a dropdown style.

So far, I have a property defined which displays the dropdown arrow when
clicked but does not expand, I also do not know how to populate the
dropdown. The dropdown needs to be populated with values read from the DB,
the values can be read into a Dataset/datareader (which I can do), so I need
to know how to bind these to a dropdown and have the dropdown assigned to
the property. So far I have the following:

1.. My control
Imports System

Imports System.Web.UI

Imports System.Web.UI.W ebControls

Imports System.Componen tModel

Imports System.Text

Imports System.Drawing

Imports UniversalDropdo wnEditor

Namespace CustomAddressCo ntrol

<DefaultPropert y("Title"), ToolboxData("<{ 0}:Address
runat=server></{0}:Address>")_

Public Class Address

Inherits System.Web.UI.W ebControls.WebC ontrol

Private iDataSource As String

<Description("T he source/origin of the data."), _

Editor(GetType( EntryModeEditor ), _

GetType(System. Drawing.Design. UITypeEditor))_

Public Property DataSource() As String

Get

Return iDataSource

End Get

Set(ByVal Value As String)

iDataSource = Value

End Set

End Property

.......

2.. My EntryModeEditor Class
Imports System

Imports System.Componen tModel

Imports System.Componen tModel.Design

Imports System.Drawing

Imports System.Drawing. Design

Imports System.Windows. Forms

Imports System.Windows. Forms.Design

<System.Securit y.Permissions.P ermissionSetAtt ribute(System.S ecurity.Permiss ions.SecurityAc tion.Demand,
Name:="FullTrus t")_

Public Class EntryModeEditor

Inherits System.Drawing. Design.UITypeEd itor

Public Overloads Overrides Function EditValue(ByVal context As
System.Componen tModel.ITypeDes criptorContext, ByVal provider As
IServiceProvide r, ByVal value As Object) As Object

Dim returnValue As Object = value

If Not (provider Is Nothing) Then

'I DO NOT KNOW WHAT SHOULD GO IN HERE, TO POPULATE THE DROPDOWN AND GET OUT
THE VALUE THAT WAS SELECTED

End If

Return value

End Function

Public Overloads Overrides Function GetEditStyle(By Val context As _

System.Componen tModel.ITypeDes criptorContext) As _

System.Drawing. Design.UITypeEd itorEditStyle

If context Is Nothing Then

Return MyBase.GetEditS tyle(context)

Else

Return System.Drawing. Design.UITypeEd itorEditStyle.D ropDown

End If

End Function

End Class

Any help/suggestions would be gratefully appreciated.

Thanks,

Kay.
Oct 25 '06 #1
0 1608

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1179
by: Ed Bick | last post by:
I built a custom control. It has one custom property that I created exposed. What I want to do though is to have the property show as a dropdown with only a limited number of choices for settings. An example would be the dropdown style of a combo box. The designer can only select one of three previously defined options and can not type anything arbitrary in. Can anyone explain how to do that?
2
19856
by: Mamatha | last post by:
Hi I want to add an icon to the textbox's text. I don't know how to display icon in textbox in VB.NET. If any one knows please let me know. Thanks in advance. Mamatha
0
1262
by: Kay | last post by:
Hello, I have developed a web custom control, I want one of the properties of the control to appear as a dropdown list so the user can select from the list. My question is: how do I define an editor to fill up the dropdown list, so far I have the following code which displays the property as a dropdown but I do not know how to get values it to it, I have only 3 values. Public Class EntryModeEditor Inherits...
0
1236
by: Kay | last post by:
Hello, I have developed a web custom control, I want one of the properties of the control to appear as a dropdown list so the user can select from the list. My question is: how do I define an editor to fill up the dropdown list, so far I have the following code which displays the property as a dropdown but I do not know how to get values it to it, I have only 3 values. Public Class EntryModeEditor Inherits...
0
1345
by: Kay | last post by:
Hello, I have written my own custom control and I want one of its properties to display as a dropdown list when clicked, so the user can select from the list, it would be similar to the asp textbox control which has a ‘TextMode’ property and when clicked on, displays as a dropdown list with 3 values, I want to have a similar type property with a dropdown style. So far, I have a property defined which displays the dropdown arrow...
4
2735
by: rszebras | last post by:
I inherited a database (as a novice at Access) and need to modify it to make it more efficient, i.e., the assignment form needs to autopopulate with the client's name, address, phone number, etc., when you select the cust id. Found this cited as a good method: http://www.mvps.org/access/forms/frm0058.htm I have two tables (clients, assignments) and one form (assignment input) in the database. I have a control box called CUST ID in the...
1
2437
by: --== Alain ==-- | last post by:
Hi, I have a huge problem... My property does not appear in the "propertyGrid" of "test Container", when i test my custom control. Here is the custom control code : namespace ARListView.Design {
2
4223
by: R.A.F. | last post by:
Hi, I have a custom control in which i have a collection property named "Columns". this collection property add/remove column objects. in my Column class i have a property named Alignment which use a custom property editor. when this property editor is not linked to this property,
18
2138
by: Academia | last post by:
I let the use modify the text of a combobox and then I replace the selected item with the new text (in Keyup event). But if he sets the Text property to an empty string ("") that sets the SelectedIndex to -1. Do you have any suggestion for getting around this problem?
0
8599
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8531
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9079
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8791
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6457
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4550
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1952
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.