稍加改动,就可以实现一个完整的查询功能
废话少说,直接上代码:
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraGrid.Columns;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
var cb = new RepositoryItemComboBox() { TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor };
cb.Items.Add("");
gridControl1.RepositoryItems.Add(cb);
gridView1.Columns.AddRange(new GridColumn[] { new GridColumn() { Caption = "选项", FieldName = "FieldName", ColumnEdit = cb, Visible = true }, new GridColumn() { Caption = "值", FieldName = "Value", Visible = true } });
var dt = new