GroupBox对象引用错误

时间:2012-08-06 10:07:47

标签: c# wpf xaml nullreferenceexception groupbox

我有几个GroupBox控件,除了一个以外都可以正常工作。代码是一样的,我看不出问题可能是什么。我得到NullReferenceException。有没有人有任何线索?这是XAML:

<GroupBox Header="Load neural network" Height="90" HorizontalAlignment="Left" Margin="416,34,0,0" Name="groupBox3" VerticalAlignment="Top" Width="207" IsEnabled="False">
    <Grid>
        <Button Content="Load" Height="23" HorizontalAlignment="Left" Margin="114,32,0,0" Name="loadBTN" VerticalAlignment="Top" Width="75" />
            <TextBox Height="23" HorizontalAlignment="Left" Margin="6,32,0,0" Name="textBox1" VerticalAlignment="Top" Width="93" />
    </Grid>
</GroupBox>

这是错误弹出的代码:

private void loadRBcheck_Checked(object sender, RoutedEventArgs e)
{
    newRBcheck.IsChecked = false;
    groupBox1.IsEnabled = false;
    groupBox2.IsEnabled = false;
    inputTB.IsEnabled = false;
    hiddenTB.IsEnabled = false;
    outputTB.IsEnabled = false;
    groupBox3.IsEnabled = true; //this line causes error
    label1.IsEnabled = false;
    label2.IsEnabled = false;
    label3.IsEnabled = false;
}

0 个答案:

没有答案