I have a form implemented as shown below. If I define the tp_
data member as private it is always null in the Click event
handler. When I remove private and let it use the default
access ( which I think is private ) then it is ok ( non null ) in the
Click handler. I don't understand why?
public partial class Properties_Form_TiePoint : Form
{
// this declaration works ok
Tiepoint tp_ = new Tiepoint();
// this one doesn't
// private Tiepoint tp_ = new Tiepoint();
public Tiepoint ImageTiePoint
{
get { return tp_; }
set { tp_ = value; }
}
public Properties_Form_TiePoint()
{
InitializeComponent();
//tp_ is ok here
}
private void OKButton_Click(object sender, EventArgs e)
{
// tp_ is null if declared with private
tp_.Name = TiepointName_Text.Text;
DialogResult = DialogResult.OK;
}
}
Thanks for any answers
Frank