请教 未将兑现个引用到实例?
lflsg 2015-04-09 10:28:56 gfclass.GiftsClass = xzlpfltxt.Text; //断点在这里出错, xzlpfltxt.Text; 这个变量是有值得,但是不能赋值,
晕了现在,求教?
源代码
private void btnenter_Click(object sender, RoutedEventArgs e)
{
GiftClass gfclass = (GiftClass)grid.DataContext;
if (xzlpfltxt.Text == "")
{
MessageBox.Show("请输入礼品分类名称");
return;
}
gfclass.GiftsClass = xzlpfltxt.Text; //断点在这里出错, xzlpfltxt.Text; 这个变量是有值得,但是不能赋值,
if (IsAddNew)
{
new GiftClassDAL().insert(gfclass);
//
//this.Close();
}
else
{
new GiftClassDAL().Update(gfclass);
//this.Close();
}
//DialogResult = true;
this.DialogResult = false;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if (!IsAddNew)
{
grid.DataContext = new GiftClassDAL().GetByNumber(NumberId);
}
}
}
}
xaml 代码
<Grid Name="grid">
<Label Content="请输入礼品分类名称" Height="28" HorizontalAlignment="Left" Margin="19,19,0,0" VerticalAlignment="Top" />
<TextBox Height="119" HorizontalAlignment="Left" Margin="31,45,0,0" Name="xzlpfltxt" Text="{Binding GiftsClass}" VerticalAlignment="Top" Width="215" TextWrapping="Wrap" AcceptsReturn="True" />
<Button Content="确 定" Height="23" HorizontalAlignment="Left" Margin="99,184,0,0" Name="btnenter" VerticalAlignment="Top" Width="75" Click="btnenter_Click" />
</Grid>