数据库连接字符串 ConnectionString

参考:https://www.devexpress.com/Support/Center/Question/Details/K18445/how-to-create-a-correct-connection-string-for-xpo-providers

AccessConnectionProvider: MSAccess
XpoProvider=MSAccess;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;
DataSetDataStore: XmlDataSet
XpoProvider=XmlDataSet;Data Source=C:\mydatabase.xml;Read Only=false
InMemoryDataStore: InMemoryDataStore
XpoProvider=InMemoryDataStore;Data Source=C:\mydatabase.xml;Read Only=false
MSSqlConnectionProvider: MSSqlServer
XpoProvider=MSSqlServer;Data Source=(local);User ID=username;Password=password;Initial Catalog=database;Persist Security Info=true
AdvantageConnectionProvider: Advantage
XpoProvider=Advantage;Data Source=\myserver\myvolume\mypat\mydd.add;ServerType=local;User ID=ASSSYS;TrimTrailingSpaces=true
AsaConnectionProvider: Asa
XpoProvider=Asa;Uid=MyUsername;PWD=MyPassword;DBF=c:\mydatabase.db;Persist Security Info=true
AseConnectionPrvider: Ase
XpoProvider=Ase;Port=5000;Data Source=MyAseServer;User ID=MyUserName;Password=MyPassword;Initial Catalog=MyDatabase;Persist Security Info=true
DB2ConnectionProvider: DB2
XpoProvider=DB2;Server=MyAddress:MyPortNumber;User ID=MyUserName;Password=MyPassword;Database=MyDatabase;Persist Security Info=true
FirebirdConnectionProvider: Firebird
XpoProvider=Firebird;DataSource=localhost;User=SYSDBA;Password=masterkey;Database=MyDatabase.fdb;ServerType=0;Charset=NONE
MSSqlCEConnectionProvider: MSSqlServerCE
XpoProvider=MSSqlServerCE;Data Source=MyDatabase.sdf;Password=MyPassword
MySqlConnectionProvider: MySql
XpoProvider=MySql;Server=MyServerAddress;User ID=MyUserName;Password=MyPassword;Database=MyDatabase;Persist Security Info= true;Charset=utf8
ODPConnectionProvider: ODP
XpoProvider=ODP;Data Source=TORCL;User ID=MyUserName;Password=MyPassword
ODPManagedConnectionProvider: ODPManaged
XpoProvider=ODPManaged;Data Source=TORCL;User ID=MyUserName;Password=MyPassword
OracleConnectionProvider: Oracle
XpoProvider=Oracle;Data Source=TORCL;User ID=MyUserName;Password=MyPassword
PervasiveSqlConnectionProvider: Pervasive
XpoProvider=Pervasive;Server=MyServerAddress;UID=MyUserName;PWD=MyPassword;ServerDSN=MyDatabase
PostgreSqlConnectionProvider: Postgres
XpoProvider=Postgres;Server=127.0.0.1;User ID=MyUserName;Password=MyPassword;Database=MyDatabase;Encoding=UNICODE
SQLiteConnectionProvider: SQLite
XpoProvider=SQLite;Data Source=filename
VistaDBConnectionProvider: VistaDB
XpoProvider=VistaDB;Data Source=C:\mydatabase.vdb4
VistaDB5ConnectionProvider: VistaDB5
XpoProvider=VistaDB5;Data Source=C:\mydatabase.vdb5

如何给程序添加自定义皮肤

来源:https://documentation.devexpress.com/#SkinEditor/CustomDocument2546
1、在VS里,通过Devexpress>Winform Controls v…>Run Skin Editor启动皮肤编辑器

2、新建皮肤项目

3、选择基础皮肤,记住新皮肤名称(skin name)

4、选择要修改的控件,双击黄框部分进行图像编辑。
注:请在Tools>Options…菜单下,指定图像编辑器程序

5、图像编辑完成后,单击【Load Image】等进行图像替换

6、保存工程后,通过菜单File>Create Assembly生成dll。默认在文档\My DXSkins文件夹下

7、随后弹出如下窗口。将这些内容对应地复制到解决方案的 Program.cs/Program.vb 文件的方法里。

8、打开【解决方案资源管理器】,添加引用
注:添加完成后,需要保存解决方案,重启VS。

9、打开【Program.vb】文件,添加如下内容。

注:参考步骤7内容

Imports System
Imports System.Configuration
Imports System.Windows.Forms
Imports DevExpress.Persistent.Base
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Security
Imports DevExpress.ExpressApp.Win
Imports DevExpress.Persistent.BaseImpl
Imports 乐智ERP.Win
Imports DevExpress.Skins
Imports System.ComponentModel
Imports DevExpress.LookAndFeel

Public Class Program

    <STAThread()>
    Public Shared Sub Main(ByVal arguments() As String)


        '开始
        Dim asm As System.Reflection.Assembly = GetType(DevExpress.UserSkins.ilezhiskin).Assembly
        DevExpress.Skins.SkinManager.Default.RegisterAssembly(asm)
        SkinManager.EnableFormSkins()
        '结束


#If EASYTEST Then
              DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register()
#End If

        Application.EnableVisualStyles()
        Application.SetCompatibleTextRenderingDefault(False)
        EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached
        If Tracing.GetFileLocationFromSettings() = DevExpress.Persistent.Base.FileLocation.CurrentUserApplicationDataFolder Then
            Tracing.LocalUserAppDataPath = Application.LocalUserAppDataPath
        End If
        Tracing.Initialize()
        Dim _application As 乐智ERPWindowsFormsApplication = New 乐智ERPWindowsFormsApplication()
        ' Refer to the https://documentation.devexpress.com/eXpressAppFramework/CustomDocument112680.aspx help article for more details on how to provide a custom splash form.
        '_application.SplashScreen = New DevExpress.ExpressApp.Win.Utils.DXSplashScreen("YourSplashImage.png")
        SecurityAdapterHelper.Enable()
        If (Not ConfigurationManager.ConnectionStrings.Item("ConnectionString") Is Nothing) Then
            _application.ConnectionString = ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString
        End If
#If EASYTEST Then
        If (Not ConfigurationManager.ConnectionStrings.Item("EasyTestConnectionString") Is Nothing) Then
            _application.ConnectionString = ConfigurationManager.ConnectionStrings.Item("EasyTestConnectionString").ConnectionString
        End If
#End If
        If System.Diagnostics.Debugger.IsAttached Then
            _application.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways
        End If
        Try
            '开始
            UserLookAndFeel.Default.SkinName = "ilezhi"
            ‘结束
            _application.Setup()
            _application.Start()
        Catch e As Exception
            _application.HandleException(e)
        End Try
    End Sub
End Class

’开始
Public Class SkinRegistration
    Inherits Component

    Public Sub New()
        DevExpress.Skins.SkinManager.Default.RegisterAssembly(GetType(DevExpress.UserSkins.ilezhiskin).Assembly)
    End Sub
End Class
‘结束

 

======================= 有用的皮肤数据=======================

Common > TextBorder,文本边框

 

GridView.RowCount 与 GridView.DataRowCount 的区别

RowCount

GridView.RowCount Property | WinForms Controls | DevExpress Help

This property overrides the BaseView.RowCount property to increment its value in the following cases:

NoteDetail pattern Views do not contain data and they are never displayed within XtraGrid. So, the RowCount member must not be invoked for these Views. The RowCount member can only be used with real Views that are displayed within the Grid Control. The real Views with which an end-user interacts at runtime can be accessed using the following methods.

DataRowCount

BaseView.DataRowCount Property | WinForms Controls | DevExpress Help

Note that data rows can be hidden within collapsed groups when data grouping is applied. The DataRowCount property returns the total number of data rows regardless of whether they are within collapsed groups or not. Also, the property’s return value is not always the same as the number of records within the associated data source. When data filtering is applied, the DataRowCount property returns the number of rows that match the filter condition.

NoteDetail pattern Views do not contain data and they are never displayed within XtraGrid. So, the DataRowCount member must not be invoked for these Views. The DataRowCount member can only be used with real Views that are displayed within the Grid Control. The real Views with which an end-user interacts at runtime can be accessed using the following methods.

试比较:

Private Sub GridView1_MouseDown(sender As Object, e As MouseEventArgs) Handles GridView1.MouseDown
        Dim view As GridView = TryCast(sender, GridView)
        Dim hitInfo As GridHitInfo = view.CalcHitInfo(e.Location)
        Select Case hitInfo.HitTest
            Case GridHitTest.Column
                SelectColumn(view, hitInfo)
            Case Else                ' 
                view.OptionsSelection.MultiSelect = False
                view.OptionsSelection.MultiSelectMode = GridMultiSelectMode.RowSelect
        End Select
 End Sub

 Private Sub SelectColumn(ByRef View As GridView, ByRef hitinfo As GridHitInfo)
        '全选列(不排列)
        View.OptionsSelection.MultiSelect = True
        View.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CellSelect
        View.OptionsCustomization.AllowSort = False
        View.ClearSelection()

        View.SelectCells(New GridCell(0, hitinfo.Column), New GridCell(View.DataRowCount - 1, hitinfo.Column))
        View.OptionsCustomization.AllowSort = True
End Sub

 

addhanderl与handels区别

遇到一个问题。addhandler 与 handels的区别是什么

举例:如下语句运行成功

 Private Sub 供货商IDSearchLookUpEdit_TextChanged(sender As Object, e As EventArgs) Handles 供货商IDSearchLookUpEdit.TextChanged
        MsgBox(sender.name, MsgBoxStyle.OkCancel, "测试")
End Sub

如下语句不成功

Private Sub 主界面_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    AddHandler 供货商IDSearchLookUpEdit.TextChanged, AddressOf 供货商IDSearchLookUpEdit_TextChanged
end sub

Private Sub 供货商IDSearchLookUpEdit_TextChanged(sender As Object, e As EventArgs)
        'Handles 供货商IDSearchLookUpEdit.TextChanged
        MsgBox(sender.name, MsgBoxStyle.OkCancel, "测试")
End Sub

 

如何修改 cell 值

Private Sub GridView1_CellValueChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs) Handles GridView1.CellValueChanged
        If e.Column.FieldName = "FieldName" Then
            GridView1.SetRowCellValue(e.RowHandle, "columnName", "value")
        End If
End Sub

注:千万必要写成以下形式,否则会引发System.StackOverflowException 异常

Private Sub GridView1_CellValueChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs) Handles GridView1.CellValueChanged
        If GridView1.FocusedColumn.FieldName = "FieldName" Then
            GridView1.SetRowCellValue(e.RowHandle, "columnName", "value")
        End If
End Sub

相关链接:https://www.devexpress.com/Support/Center/Question/Details/T352822

如何让TreeListLookup在弹出时,自动对焦到搜索框

QQ截图20160516152712

如图所示,在弹出时,自动对焦到红框区域。

 Private Sub 商品查找品牌RepositoryItemTreeListLookUpEdit_Popup(sender As Object, e As EventArgs) Handles 商品查找品牌RepositoryItemTreeListLookUpEdit.Popup
        Dim editor As TreeListLookUpEdit = CType(sender, TreeListLookUpEdit)
        editor.Properties.TreeList.ShowFindPanel()
End Sub
 Private Sub 商品查找商品RepositoryItemSearchLookUpEdit_Popup(sender As Object, e As EventArgs) Handles 商品查找商品RepositoryItemSearchLookUpEdit.Popup
        Dim editor As SearchLookUpEdit = CType(sender, SearchLookUpEdit)
        editor.Properties.View.ShowFindPanel()
End Sub