add WIP lookup grid control

This commit is contained in:
Jonathan Jenne 2018-09-21 14:56:11 +02:00
parent 5c4462b9ec
commit da8f95062d
22 changed files with 1270 additions and 0 deletions

View File

@ -29,6 +29,10 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Variables", "Variables\Vari
EndProject EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Config", "Config\Config.vbproj", "{44982F9B-6116-44E2-85D0-F39650B1EF99}" Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Config", "Config\Config.vbproj", "{44982F9B-6116-44E2-85D0-F39650B1EF99}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Controls", "Controls", "{F98C0329-C004-417F-B2AB-7466E88D8220}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "LookupGrid", "LookupGrid\LookupGrid.vbproj", "{3DCD6D1A-C830-4241-B7E4-27430E7EA483}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -71,6 +75,10 @@ Global
{44982F9B-6116-44E2-85D0-F39650B1EF99}.Debug|Any CPU.Build.0 = Debug|Any CPU {44982F9B-6116-44E2-85D0-F39650B1EF99}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44982F9B-6116-44E2-85D0-F39650B1EF99}.Release|Any CPU.ActiveCfg = Release|Any CPU {44982F9B-6116-44E2-85D0-F39650B1EF99}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44982F9B-6116-44E2-85D0-F39650B1EF99}.Release|Any CPU.Build.0 = Release|Any CPU {44982F9B-6116-44E2-85D0-F39650B1EF99}.Release|Any CPU.Build.0 = Release|Any CPU
{3DCD6D1A-C830-4241-B7E4-27430E7EA483}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DCD6D1A-C830-4241-B7E4-27430E7EA483}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DCD6D1A-C830-4241-B7E4-27430E7EA483}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DCD6D1A-C830-4241-B7E4-27430E7EA483}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -85,6 +93,7 @@ Global
{63B0EAA3-8BF5-46DA-9040-15E781F4C3B1} = {7AF3F9C2-C939-4A08-95C1-0453207E298A} {63B0EAA3-8BF5-46DA-9040-15E781F4C3B1} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
{836C9ADE-E04E-4E1E-B17A-201E68014790} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC} {836C9ADE-E04E-4E1E-B17A-201E68014790} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC}
{44982F9B-6116-44E2-85D0-F39650B1EF99} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC} {44982F9B-6116-44E2-85D0-F39650B1EF99} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC}
{3DCD6D1A-C830-4241-B7E4-27430E7EA483} = {F98C0329-C004-417F-B2AB-7466E88D8220}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286} SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286}

61
LookupGrid/LookupGrid.Designer.vb generated Normal file
View File

@ -0,0 +1,61 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class LookupGrid
Inherits System.Windows.Forms.UserControl
'UserControl überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(0, 0)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(231, 20)
Me.TextBox1.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(237, 0)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(56, 20)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleBackColor = True
'
'LookupGrid
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.Transparent
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox1)
Me.Name = "LookupGrid"
Me.Size = New System.Drawing.Size(323, 57)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents TextBox1 As Windows.Forms.TextBox
Friend WithEvents Button1 As Windows.Forms.Button
End Class

120
LookupGrid/LookupGrid.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

4
LookupGrid/LookupGrid.vb Normal file
View File

@ -0,0 +1,4 @@

Public Class LookupGrid
End Class

View File

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3DCD6D1A-C830-4241-B7E4-27430E7EA483}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>LookupGrid</RootNamespace>
<AssemblyName>LookupGrid</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Windows</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>LookupGrid.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>LookupGrid.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="DevExpress.Office.v18.1.Core, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.Office.v18.1.Core.dll</HintPath>
</Reference>
<Reference Include="DevExpress.Pdf.v18.1.Core, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.Pdf.v18.1.Core.dll</HintPath>
</Reference>
<Reference Include="DevExpress.Printing.v18.1.Core, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.Printing.v18.1.Core.dll</HintPath>
</Reference>
<Reference Include="DevExpress.RichEdit.v18.1.Core, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.RichEdit.v18.1.Core.dll</HintPath>
</Reference>
<Reference Include="DevExpress.RichEdit.v18.1.Export, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.RichEdit.v18.1.Export.dll</HintPath>
</Reference>
<Reference Include="DevExpress.Utils.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraGrid.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraLayout.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.XtraLayout.v18.1.dll</HintPath>
</Reference>
<Reference Include="DevExpress.XtraPrinting.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.XtraPrinting.v18.1.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="frmLookupGrid.Designer.vb">
<DependentUpon>frmLookupGrid.vb</DependentUpon>
</Compile>
<Compile Include="frmLookupGrid.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="LookupGrid.Designer.vb">
<DependentUpon>LookupGrid.vb</DependentUpon>
</Compile>
<Compile Include="LookupGrid.vb">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="LookupGridHandler.vb" />
<Compile Include="LookupGridRegistration.vb" />
<Compile Include="LookupGridView.Designer.vb">
<DependentUpon>LookupGridView.vb</DependentUpon>
</Compile>
<Compile Include="LookupGridView.vb">
<SubType>Component</SubType>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="LookupGridControl.Designer.vb">
<DependentUpon>LookupGridControl.vb</DependentUpon>
</Compile>
<Compile Include="LookupGridControl.vb">
<SubType>Component</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="frmLookupGrid.resx">
<DependentUpon>frmLookupGrid.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LookupGrid.resx">
<DependentUpon>LookupGrid.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\licenses.licx" />
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Service Include="{94E38DFF-614B-4CBD-B67C-F211BB35CE8B}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

47
LookupGrid/LookupGridControl.Designer.vb generated Normal file
View File

@ -0,0 +1,47 @@
Partial Class SimpleGridControl
Inherits System.ComponentModel.Component
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal container As System.ComponentModel.IContainer)
MyClass.New()
'Erforderlich für die Unterstützung des Windows.Forms-Klassenkompositions-Designers
If (container IsNot Nothing) Then
container.Add(Me)
End If
End Sub
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New()
MyBase.New()
'Dieser Aufruf ist für den Komponenten-Designer erforderlich.
InitializeComponent()
End Sub
'Die Komponente überschreibt den Löschvorgang zum Bereinigen der Komponentenliste.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Komponenten-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Komponenten-Designer erforderlich.
'Das Bearbeiten ist mit dem Komponenten-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class

View File

@ -0,0 +1,18 @@
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Registrator
Namespace LookupGrid
Public Class LookupGridControl
Inherits GridControl
Protected Overrides Function CreateDefaultView() As BaseView
Return CreateView("LookupGridView")
End Function
Protected Overrides Sub RegisterAvailableViewsCore(ByVal collection As InfoCollection)
MyBase.RegisterAvailableViewsCore(collection)
collection.Add(New MyGridViewInfoRegistrator())
End Sub
End Class
End Namespace

View File

@ -0,0 +1,19 @@
Imports System.Windows.Forms
Imports DevExpress.XtraGrid.Views.Grid
Namespace LookupGrid
Public Class LookupGridHandler
Inherits Handler.GridHandler
Public Sub New(ByVal gridView As GridView)
MyBase.New(gridView)
End Sub
Protected Overrides Sub OnKeyDown(ByVal e As KeyEventArgs)
MyBase.OnKeyDown(e)
If e.KeyData = Keys.Delete AndAlso View.State = GridState.Normal Then
View.DeleteRow(View.FocusedRowHandle)
End If
End Sub
End Class
End Namespace

View File

@ -0,0 +1,24 @@
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Views.Base.Handler
Imports DevExpress.XtraGrid.Registrator
Namespace LookupGrid
Public Class MyGridViewInfoRegistrator
Inherits GridInfoRegistrator
Public Overrides ReadOnly Property ViewName() As String
Get
Return "LookupGridView"
End Get
End Property
Public Overrides Function CreateView(ByVal grid As GridControl) As BaseView
Return New LookupGridView(grid)
End Function
Public Overrides Function CreateHandler(ByVal view As BaseView) As BaseViewHandler
Return New LookupGridHandler(TryCast(view, LookupGridView))
End Function
End Class
End Namespace

47
LookupGrid/LookupGridView.Designer.vb generated Normal file
View File

@ -0,0 +1,47 @@
Partial Class LookupGridView
Inherits System.ComponentModel.Component
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal container As System.ComponentModel.IContainer)
MyClass.New()
'Erforderlich für die Unterstützung des Windows.Forms-Klassenkompositions-Designers
If (container IsNot Nothing) Then
container.Add(Me)
End If
End Sub
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New()
MyBase.New()
'Dieser Aufruf ist für den Komponenten-Designer erforderlich.
InitializeComponent()
End Sub
'Die Komponente überschreibt den Löschvorgang zum Bereinigen der Komponentenliste.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Komponenten-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Komponenten-Designer erforderlich.
'Das Bearbeiten ist mit dem Komponenten-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class

View File

@ -0,0 +1,55 @@
Imports DevExpress.Data.Helpers
Imports DevExpress.Data.Filtering
Imports DevExpress.XtraGrid.Views.Base
Imports System.Reflection
Namespace LookupGrid
Public Class LookupGridView
Inherits DevExpress.XtraGrid.Views.Grid.GridView
Private _simpleSearch As Boolean
Public Sub New()
Me.New(Nothing)
End Sub
Public Property SimpleSearch() As Boolean
Get
Return _simpleSearch
End Get
Set(ByVal value As Boolean)
_simpleSearch = value
End Set
End Property
Public Sub New(ByVal grid As DevExpress.XtraGrid.GridControl)
MyBase.New(grid)
' put your initialization code here
End Sub
Protected Overrides ReadOnly Property ViewName() As String
Get
Return "LookupGridView"
End Get
End Property
Protected Overrides Function ConvertGridFilterToDataFilter(ByVal criteria As CriteriaOperator) As CriteriaOperator
Dim originalFindFilterText As String = Convert.ToString(GetType(ColumnView).InvokeMember("findFilterText", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.GetField, Nothing, Me, New Object() {}))
If SimpleSearch Then
If Not (String.IsNullOrEmpty(originalFindFilterText)) Then
GetType(ColumnView).InvokeMember("findFilterText", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.SetField, Nothing, Me, New Object() {String.Concat("""", originalFindFilterText, """")})
End If
Dim findCriteria As CriteriaOperator = Nothing
Dim _lastParserResults As FindSearchParserResults = Nothing
If Not (String.IsNullOrEmpty(FindFilterText)) Then
_lastParserResults = (New FindSearchParser()).Parse(FindFilterText, GetFindToColumnsCollection())
GetType(ColumnView).GetField("lastParserResults", BindingFlags.NonPublic Or BindingFlags.Instance).SetValue(Me, _lastParserResults)
If Not IsServerMode Then
_lastParserResults.AppendColumnFieldPrefixes()
End If
findCriteria = DxFtsContainsHelperAlt.Create(_lastParserResults, FilterCondition.Contains, IsServerMode)
End If
GetType(ColumnView).InvokeMember("findFilterText", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.SetField, Nothing, Me, New Object() {originalFindFilterText})
Return criteria And findCriteria
End If
Return MyBase.ConvertGridFilterToDataFilter(criteria)
End Function
End Class
End Namespace

View File

@ -0,0 +1,13 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>false</MySubMain>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>1</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@ -0,0 +1,35 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' Allgemeine Informationen über eine Assembly werden über die folgenden
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
' die einer Assembly zugeordnet sind.
' Werte der Assemblyattribute überprüfen
<Assembly: AssemblyTitle("LookupGrid")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("LookupGrid")>
<Assembly: AssemblyCopyright("Copyright © 2018")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
<Assembly: Guid("29cb2b66-3763-4f79-8e4b-6e15fdcae4b6")>
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
'
' Hauptversion
' Nebenversion
' Buildnummer
' Revision
'
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -0,0 +1,62 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("LookupGrid.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.LookupGrid.My.MySettings
Get
Return Global.LookupGrid.My.MySettings.Default
End Get
End Property
End Module
End Namespace

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1 @@
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

103
LookupGrid/frmLookupGrid.Designer.vb generated Normal file
View File

@ -0,0 +1,103 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmLookupGrid
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.gridLookup = New DevExpress.XtraGrid.GridControl()
Me.viewLookup = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.btnOK = New System.Windows.Forms.Button()
Me.btnClear = New System.Windows.Forms.Button()
CType(Me.gridLookup, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.viewLookup, System.ComponentModel.ISupportInitialize).BeginInit()
Me.Panel1.SuspendLayout()
Me.SuspendLayout()
'
'gridLookup
'
Me.gridLookup.Dock = System.Windows.Forms.DockStyle.Fill
Me.gridLookup.Location = New System.Drawing.Point(0, 0)
Me.gridLookup.MainView = Me.viewLookup
Me.gridLookup.Name = "gridLookup"
Me.gridLookup.Size = New System.Drawing.Size(384, 221)
Me.gridLookup.TabIndex = 0
Me.gridLookup.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.viewLookup})
'
'viewLookup
'
Me.viewLookup.GridControl = Me.gridLookup
Me.viewLookup.Name = "viewLookup"
'
'Panel1
'
Me.Panel1.Controls.Add(Me.btnOK)
Me.Panel1.Controls.Add(Me.btnClear)
Me.Panel1.Dock = System.Windows.Forms.DockStyle.Bottom
Me.Panel1.Location = New System.Drawing.Point(0, 221)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(384, 40)
Me.Panel1.TabIndex = 1
'
'btnOK
'
Me.btnOK.Location = New System.Drawing.Point(12, 6)
Me.btnOK.Name = "btnOK"
Me.btnOK.Size = New System.Drawing.Size(117, 23)
Me.btnOK.TabIndex = 0
Me.btnOK.Text = "OK"
Me.btnOK.UseVisualStyleBackColor = True
'
'btnClear
'
Me.btnClear.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnClear.Location = New System.Drawing.Point(236, 6)
Me.btnClear.Name = "btnClear"
Me.btnClear.Size = New System.Drawing.Size(136, 23)
Me.btnClear.TabIndex = 0
Me.btnClear.Text = "Leeren"
Me.btnClear.UseVisualStyleBackColor = True
'
'frmLookupGrid
'
Me.AcceptButton = Me.btnOK
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(384, 261)
Me.Controls.Add(Me.gridLookup)
Me.Controls.Add(Me.Panel1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow
Me.MinimumSize = New System.Drawing.Size(400, 300)
Me.Name = "frmLookupGrid"
Me.Text = "frmLookupGrid"
CType(Me.gridLookup, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.viewLookup, System.ComponentModel.ISupportInitialize).EndInit()
Me.Panel1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
Friend WithEvents gridLookup As DevExpress.XtraGrid.GridControl
Friend WithEvents viewLookup As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents Panel1 As Windows.Forms.Panel
Friend WithEvents btnOK As Windows.Forms.Button
Friend WithEvents btnClear As Windows.Forms.Button
End Class

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

151
LookupGrid/frmLookupGrid.vb Normal file
View File

@ -0,0 +1,151 @@
Imports System.Windows.Forms
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid
Public Class frmLookupGrid
Public Property MultiSelect As Boolean
Public Property AddNewValues As Boolean
Public Property PreventDuplicates As Boolean
Public Property DataSource As DataTable
Public Property SelectedValues As List(Of Object)
Private originalValues As List(Of Object)
Private dataColumn As Integer
Private view As GridView
Private grid As GridControl
Private Sub frmLookupGrid_Load(sender As Object, e As EventArgs) Handles Me.Load
view = viewLookup
grid = gridLookup
' Datasource setzen
grid.DataSource = DataSource
' Anzeige Eigeschaften setzen
view.OptionsFind.AlwaysVisible = True
view.OptionsSelection.MultiSelect = False
If MultiSelect Then
' Selected Spalte anpassen
Dim checkboxColumn = view.Columns.Item(0)
checkboxColumn.Caption = " "
checkboxColumn.MaxWidth = 10
Text = "Wählen Sie einen oder mehrere Werte:"
dataColumn = 1
Else
Text = "Wählen Sie einen Wert:"
dataColumn = 0
End If
If AddNewValues Then
view.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.True
view.OptionsView.NewItemRowPosition = NewItemRowPosition.Top
Else
view.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.False
view.OptionsView.NewItemRowPosition = NewItemRowPosition.None
End If
' Wenn Selected Values nicht gesetzt ist, leere Liste anlegen
If SelectedValues Is Nothing Then
SelectedValues = New List(Of Object)
End If
' Ursprüngliche Werte zwischenspeichern
originalValues = SelectedValues
' Bereits ausgewählte Werte im grid auswählen
SyncItemsWithView(view)
' Focus auf Find panel setzen
view.ShowFindPanel()
End Sub
Private Sub SyncItemsWithView(view As GridView)
' Wenn Vorbelegungen existieren, werden diese angehakt
If SelectedValues.Count > 0 Then
For i = 0 To view.DataRowCount - 1
Dim rowHandle = view.GetRowHandle(i)
Dim rowView As DataRowView = view.GetRow(rowHandle)
If rowView IsNot Nothing Then
Dim row As DataRow = rowView.Row
Dim value = row.Item(dataColumn)
If SelectedValues.Contains(value) Then
If MultiSelect Then
row.Item(0) = True
Else
view.SelectRow(rowHandle)
End If
End If
End If
Next
End If
End Sub
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
' Filter vor dem Auslesen entfernen, damit alle Werte erfasst werden
view.FindFilterText = String.Empty
If MultiSelect Then
Dim values As New List(Of Object)
For index = 0 To viewLookup.DataRowCount - 1
Dim row As DataRow = view.GetDataRow(index)
Dim selected As Boolean = row.Item(0)
Dim value As Object = row.Item(1)
If selected Then
values.Add(value)
End If
Next
' Doppelte Werte entfernen, wenn konfiguriert
If PreventDuplicates Then
values = values.Distinct().ToList()
End If
SelectedValues = values
Else
Dim rowHandle As Integer = view.GetSelectedRows().ToList().First()
Dim row As DataRow = view.GetDataRow(rowHandle)
Dim value = row.Item(0)
SelectedValues = New List(Of Object) From {value}
End If
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
SelectedValues.Clear()
End Sub
Private Sub gridLookup_KeyUp(sender As Object, e As KeyEventArgs) Handles gridLookup.KeyUp
If e.KeyCode = Keys.Escape Then
Close()
End If
End Sub
Private Sub viewLookup_CellValueChanging(sender As Object, e As Views.Base.CellValueChangedEventArgs) Handles viewLookup.CellValueChanging
If e.RowHandle = GridControl.NewItemRowHandle Then
Exit Sub
End If
Dim rowHandle = e.RowHandle
Dim column = e.Column
End Sub
Private Sub viewLookup_ShowingEditor(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles viewLookup.ShowingEditor
Dim rowHandleIsNewItemRow = (view.FocusedRowHandle = GridControl.NewItemRowHandle)
Dim columnIsCheckboxColumn = view.FocusedColumn.FieldName = "SELECTED"
' Prevent editing of Data Column/allow editing for Checkbox Column and NewValue Row
If rowHandleIsNewItemRow Or columnIsCheckboxColumn Then
e.Cancel = False
Else
e.Cancel = True
End If
End Sub
End Class