Using DbCommandEditor in my own control

  • Thread starter Francois Grobler
  • Start date
F

Francois Grobler

I am writing a user control that needs to mimic some of the functionality
contained in the DataAdapter control. I need to display a list of Command
objects on the control container in the Property Browser of the control,
very similar to selecting a command for the DataAdapter control.

Normally this would be done by using a TypeConverter Attribute or an Editor
Attribute on the property, except that it seems that Microsoft did not
expose the Editor that they use in the DataAdapter in the Dot NET Framework.
My property is of the Type IDBCommand, and I therefore require either an
Editor for this Type, or a TypeConverter for this Type, or both.

I have had a look at the System.Data Assembly in ildasm and found that the
correct Editor to use is the
Microsoft.VSDesigner.Data.Design.DBCommandEditor.
(I also similarly need access to the
Microsoft.VSDesigner.Data.Design.DBConnectionEditor.)

I then set a reference to the Microsoft.VSDesigner.dll assembly in the
\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE folder. When I
run my control in the design view however it does not display this editor,
but a blank dropdown.
Is there a different Editor that can be used, is there a way to access these
editors or are they reserved for use by the Microsoft developers on the VS
IDE only?

The dropdown obviously work when I change the property type to
SQLClient.SQLCommand, then I get the dropdown showing the sql commands on
the control container. The point is that I would like to display any
command type not a specific command (any object that implemented the
idbcommand interface).

I further would like to know whether these assemblies are redistributable.

Here is a snippet of the property code:

<Category("Data"), _
Description("The data command object to use to obtain data."), _
Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor,
Microsoft.VSDesigner", GetType(System.Drawing.Design.UITypeEditor))> _
Public Property DataCommand() As IDbCommand
Get
Return _DataCommand
End Get
Set(ByVal Value As IDbCommand)
_DataCommand = Value
End Set
End Property
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top