pashi

pashi

  • NA
  • 11
  • 0

How to Handle ItemCheck Event of CHECKELISTBOX

Mar 26 2007 5:35 AM

hi all,plz tell me how to handle item_Checked event of CHECKEDLISTBOX
here below is the code i've written--but the result is nullregexception
once plz look at my code once, so that i feel u can understand my problem.

i'm filling my checkelist box in pageload using the below code,,

private void frmCustomizeParams_Load(object sender, EventArgs e)
{


blnItemChk = true;
TestingBoard.XMLTasks GetLasersProperties = new TestingBoard.XMLTasks();
string[] LaserChecking = new string[xmltask.GetLaserPropCount("tabular", "property")];
bool[] chkedList = new bool[xmltask.GetLaserPropCount("tabular", "property")];

LaserChecking = GetLasersProperties.GetLaserProp("tabular", "property");
chkedList = GetAllLaserPropchk("tabular", "property");
for (int i = 0; i < LaserChecking.Length; i++)
{
chklstMultipleMdfyTbl.Items.Add(LaserChecking[i], chkedList[i]);

if (chkedList[i])
{
lstChcked.Items.Add(LaserChecking[i]);
}
}
}
}

 

Here is the ItemCheck Event Handler to Handle the Check/Unchecked Events of itemCheck Event Hanlder, here i am taking a listbox and want to fill selected/deselected values.

here is my Item_Check Event of CheckedListBox

private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
{
if (!blnItemChk)
{

}
else
{
if (e.NewValue == CheckState.Unchecked)
{
lstChcked.Items.Remove(chklstMultipleMdfyTbl.SelectedItem.ToString());
}
else if (e.NewValue == CheckState.Checked)
{
lstChcked.Items.Add(chklstMultipleMdfyTbl.SelectedItem.ToString());
}

}

}


Compiler is giving the below exception

{"Object reference not set to an instance of an object."}

Thnx alot for ur kind response till now,
very very sorry to bother u bye byes

prashanth,
 
 
 


Answers (1)