我有以下应用程序代码:
Public Class Form1
Public Sub New()
InitializeComponent()
Dim datatableCombo = New DataTable
datatableCombo.Columns.Add("ID", GetType(Integer))
datatableCombo.Columns.Add("Name", GetType(String))
datatableCombo.Rows.Add({0, ""})
datatableCombo.Rows.Add({1, "123"})
datatableCombo.Rows.Add({2, "234"})
datatableCombo.Rows.Add({3, "456"})
UltraCombo1.DataSource = datatableCombo
Dim datatableGrid = New DataTable
datatableGrid.Columns.Add("ID", GetType(Integer))
datatableGrid.Columns.Add("Name", GetType(String))
SsiGrid1.DataSource = datatableGrid
SsiGrid1.DisplayLayout.GroupByBox.Hidden = True
SsiGrid1.DisplayLayout.Override.RowSelectors = DefaultableBoolean.True
SsiGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.TemplateOnBottom
SsiGrid1.DisplayLayout.Bands(0).Columns("ID").EditorComponent = UltraCombo1
SsiGrid1.DisplayLayout.Bands(0).Columns("ID").CellClickAction = CellClickAction.EditAndSelectText
SsiGrid1.DisplayLayout.Bands(0).Columns("ID").Style = ColumnStyle.DropDownValidate
End Sub
Private Sub UltraCombo1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraCombo1.InitializeLayout
UltraCombo1.ValueMember = "ID"
UltraCombo1.DisplayMember = "Name"
Dim band As UltraGridBand = Me.UltraCombo1.DisplayLayout.Bands(0)
Dim position As Integer = 0
band.Columns("ID").Hidden = False
band.Columns("ID").Header.VisiblePosition = position
position += 1
band.Columns("Name").Hidden = False
band.Columns("Name").Header.VisiblePosition = position
position += 1
band.Override.AllowRowFiltering = DefaultableBoolean.False
band.Override.RowFilterMode = RowFilterMode.AllRowsInBand
band.ColumnFilters("ID").FilterConditions.Clear()
band.ColumnFilters("ID").FilterConditions.Add(FilterComparisionOperator.NotEquals, 0)
End Sub
End Class
我相信这应该使组合框不会显示零行,除非您实际键入零。但是当我运行它时,它确实显示了零行。我的代码有问题吗?