I have a main form (frmMain) that displays a listbox (lboData) with values from a datasource. Upon a user double-clicking on a value from this list, another form, frmFeature, is displayed. This frmFeature contains a UserControl, ucFeature that is suppose to get the ID from the lboData from the frmMain.
This is what I have for frmMain:
This is what I have for frmFeature:
This is what I have for ucFeature:
When I run the code, I get the following: Message="Object reference not set to an instance of an object.". Any and all assistance will be greatly appreciated.
This is what I have for frmMain:
Code:
private void lboData_DoubleClick(object sender, EventArgs e)
{
string myID = lboData.SelectedValue.ToString();
frmFeature frm = new frmFeature();
frm.UC.LoadData(myID);
frm.ShowDialog();
}
Code:
public frmFeature()
{
InitializeComponent();
}
public ucFeature UC
{
get
{
return ucFeature1;
}
}
Code:
public partial class ucFeature: UserControl
{
public ucFeature(string myID)
{
string myID = null;
InitializeComponent();
DisplayID(myID);
}
public void DisplayID(string myID)
{
lblID.Text = myID.ToString();
}
...