0

它在 WPF WEB 中有一个 RadComboBox,在运行时通过数据库调用填充。该数据集通过类似于以下的指令分配给组合:

dim myNewItem as RadComboBoxItem
myRadCombo.items.clear
For each CurrentRow as DataRow in myDataset.tables(0).Rows

myNewItem = new RadComboBoxItem

With myNewITem
. Content = "some text"
. Tag = "some value"
. Foreground = New solidcolor (Colors.Some color)
End with

myRadCombo.Items.Add (myNewItem)

myNewItem = Nothing

Next

So far so good, the combo is filled smoothly, and deployed elements of the query product loaded ..... however when an item in the combo is selected, the application displays an error abruptly "Object reference not set to an instance of an目的 ”。

如果正确的话,我真的不明白这个错误的发生.... 有必要在 XML 中添加任何附加语句吗?

一些 XAML 代码:

<telerik:RadToolBar IsEnabled="True" Name="myToolBar" Grid.Row="3">

                        <telerik:Label Content="Workstation Name:" />

                        <telerik:RadComboBox Name="WorkStationList" Width="100" IsReadOnly="True">
                            <telerik:RadComboBoxItem Content="Station 1" IsSelected="True" Tag="1" />
                            <telerik:RadComboBoxItem Content="Station 2" Tag="2"/>
                            <telerik:RadComboBoxItem Content="Station 3" Tag="3"/>
                            <telerik:RadComboBoxItem Content="Station 4" Tag="4"/>
                        </telerik:RadComboBox>
                    </telerik:RadToolBar>
4

0 回答 0