G
Guest
hello all
I have exception which really doesnt make sense to me.this is my code
foreach (DataRow drowAMC in DBinter.dtabActivemenuContent.Rows)
{
if(x!=byte.Parse(drowAMC[2].ToString()))
{
this.lview = new System.Windows.Forms.ListView();
lview.CheckBoxes = true;
lview.Location = new System.Drawing.Point(8, 8);
lview.Size = new System.Drawing.Size(216, 168);
lview.View = System.Windows.Forms.View.List;
System.Windows.Forms.TabPage tpage = new System.Windows.Forms.TabPage();
tpage.Location = new System.Drawing.Point(4, 4);
tpage.Size = new System.Drawing.Size(232, 184);
tpage.Text = drowAMC[3].ToString();
tpage.Controls.Add(lview);
this.tabFormOrder.Controls.Add(tpage);
x=byte.Parse(drowAMC[2].ToString());
}
this.lViewSubItm = new
System.Windows.Forms.ListViewItem.ListViewSubItem();
this.lViewSubItm.Text = drowAMC[4].ToString();
this.lViewItm = new System.Windows.Forms.ListViewItem();
this.lViewItm.Text=drowAMC[0].ToString();
this.lViewItm.Checked=bool.Parse(drowAMC[1].ToString());
this.lViewItm.SubItems.Add(this.lViewSubItm);
this.lview.Items.Add(this.lViewItm);
OrderContent OCnt=new
OrderContent((int)drowAMC[4],1,this.MenuID,this.PatientCode,drowAMC[0].ToString(),this.lViewItm.Checked);
this.httest.Add(OCnt);
if (this.lViewItm.Checked)
{
// this.Order.OrderContent.Add(drowAMC[4].ToString(),OCnt);
// this.lboxOrderSummary.Items.Add(lViewItm.Text);
}
}
this.lboxOrderSummary.DataSource=this.httest;
this.lboxOrderSummary.DisplayMember="ItemDesc";
DBinter=null;
}
the code works fine if i comment out the line "this.httest.Add(OCnt);"
if i activate it then the line next to it " if (this.lViewItm.Checked)"
generate a exception null ref.
it seems the app loose all ref. i cannot understnad why
can any one help please
thanks in advance for the time
I have exception which really doesnt make sense to me.this is my code
foreach (DataRow drowAMC in DBinter.dtabActivemenuContent.Rows)
{
if(x!=byte.Parse(drowAMC[2].ToString()))
{
this.lview = new System.Windows.Forms.ListView();
lview.CheckBoxes = true;
lview.Location = new System.Drawing.Point(8, 8);
lview.Size = new System.Drawing.Size(216, 168);
lview.View = System.Windows.Forms.View.List;
System.Windows.Forms.TabPage tpage = new System.Windows.Forms.TabPage();
tpage.Location = new System.Drawing.Point(4, 4);
tpage.Size = new System.Drawing.Size(232, 184);
tpage.Text = drowAMC[3].ToString();
tpage.Controls.Add(lview);
this.tabFormOrder.Controls.Add(tpage);
x=byte.Parse(drowAMC[2].ToString());
}
this.lViewSubItm = new
System.Windows.Forms.ListViewItem.ListViewSubItem();
this.lViewSubItm.Text = drowAMC[4].ToString();
this.lViewItm = new System.Windows.Forms.ListViewItem();
this.lViewItm.Text=drowAMC[0].ToString();
this.lViewItm.Checked=bool.Parse(drowAMC[1].ToString());
this.lViewItm.SubItems.Add(this.lViewSubItm);
this.lview.Items.Add(this.lViewItm);
OrderContent OCnt=new
OrderContent((int)drowAMC[4],1,this.MenuID,this.PatientCode,drowAMC[0].ToString(),this.lViewItm.Checked);
this.httest.Add(OCnt);
if (this.lViewItm.Checked)
{
// this.Order.OrderContent.Add(drowAMC[4].ToString(),OCnt);
// this.lboxOrderSummary.Items.Add(lViewItm.Text);
}
}
this.lboxOrderSummary.DataSource=this.httest;
this.lboxOrderSummary.DisplayMember="ItemDesc";
DBinter=null;
}
the code works fine if i comment out the line "this.httest.Add(OCnt);"
if i activate it then the line next to it " if (this.lViewItm.Checked)"
generate a exception null ref.
it seems the app loose all ref. i cannot understnad why
can any one help please
thanks in advance for the time