Hi
ich versuche mich grad am oberen Tipp, aber ich bekomme eine NullReferenceExeption und weiß nicht warum, so tief bin ich dann doch nicht drin.
System.NullReferenceException wurde nicht von Benutzercode behandelt.
Message="Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt."
Source="xTool"
StackTrace:
...
InnerException:
Private cbo As New MultiColumnComboBox.MultiColumnComboBox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Load
Dim table As DataTable = GetTable()
With cbo
.DataSource = table
.DisplayMember = "Drug"
.ValueMember = "Dosage"
'.NotShowingColumns = "Date"
.BackFirstRowColor = Color.FloralWhite
.BackSecondRowColor = Color.MistyRose
.SelectedRowBackcolor = Color.LightCoral
.SelectedRowBackcolor = Color.Brown
.SelectedRowForecolor = Color.White
.ItemHeight = 13
.Location = New Point(79, 67)
.Size = New Size(141, 20)
'.Enabled = False
End With
Me.Controls.Add(cbo)
End Sub
Function GetTable() As DataTable
Dim table As New DataTable
table.Columns.Add("Dosage", GetType(Integer))
table.Columns.Add("Drug", GetType(String))
table.Columns.Add("Patient", GetType(String))
table.Columns.Add("Date", GetType(DateTime))
table.Rows.Add(25, "Indocin", "David", DateTime.Now)
table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now)
table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now)
table.Rows.Add(21, "Combivent", "Janet", DateTime.Now)
table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now)
Return table
End Function Der Fehler tritt in der Zeile
Dim propertyDescriptorCollection As _
PropertyDescriptorCollection = DataManager.GetItemProperties()[/B]
auf.
Private Sub InitializeColumns()
If Me.DataSource Is Nothing Then Exit Sub
Dim propertyDescriptorCollection As _
PropertyDescriptorCollection = DataManager.GetItemProperties()
columnWidths = New Single(propertyDescriptorCollection.Count - 1) {}
columnNames = New [String](propertyDescriptorCollection.Count - 1) _
{}
With propertyDescriptorCollection
For colIndex As Integer = 0 To .Count - 1
Dim name As [String] = .Item(colIndex).Name
columnNames(colIndex) = name
Next
End With
End Sub |