Imports System.ComponentModel Imports System.Data.SqlClient Imports System.Drawing.Design Imports System.Windows.Forms Imports System.Windows.Forms.Design Imports DigitalData.GUIs.Common Public Class ClassSQLEditor Inherits UITypeEditor Public Overrides Function GetEditStyle(context As ITypeDescriptorContext) As UITypeEditorEditStyle 'Return MyBase.GetEditStyle(context) Return UITypeEditorEditStyle.Modal End Function Public Overrides Function EditValue(context As ITypeDescriptorContext, provider As IServiceProvider, value As Object) As Object 'Return MyBase.EditValue(context, provider, value) Dim svc As IWindowsFormsEditorService = TryCast(provider.GetService(GetType(IWindowsFormsEditorService)), IWindowsFormsEditorService) Dim SQLString As String = DirectCast(value, SQLValue).Value If svc IsNot Nothing AndAlso SQLString IsNot Nothing Then Dim oForm2 As New DigitalData.GUIs.Common.frmSQLEditor(LOGCONFIG, MYDB_ECM) With { .SQLCommand = SQLString } Dim oResult = oForm2.ShowDialog() If oResult = DialogResult.OK Then Dim oSql As New SQLValue(oForm2.SQLCommand) value = oSql SQLString = oForm2.SQLCommand End If End If If Not IsNothing(value) Then Return value Else Return Nothing End If End Function End Class _ _ Public Class SQLValue Private _value As String Public Sub New(value As String) Me.Value = value End Sub Public Property Value As String Get Return _value End Get Set(value As String) _value = value End Set End Property End Class Public Class SQLTypeConverter Inherits TypeConverter Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As Globalization.CultureInfo, value As Object, destinationType As Type) As Object 'Return MyBase.ConvertTo(context, culture, value, destinationType) Dim sqlvalue As SQLValue = DirectCast(value, SQLValue) Return sqlvalue.Value End Function End Class