Hello all,
I have two forms.On first form i am listing rooms and second form is for editing room. I am passing Room object from first form to second form. But before second form unload the secondForm Checkboxlist itemcheck event occurs.
I used boolean var with if statement for solving it but i have two checkboxlist, it was occured again at the second checkboxlist.
How can i stop it?
Thanks.
Second form item_check event problem.
Page 1 of 14 Replies - 109 Views - Last Post: 06 February 2013 - 02:39 PM
Replies To: Second form item_check event problem.
#2
Re: Second form item_check event problem.
Posted 06 February 2013 - 01:49 PM
#3
Re: Second form item_check event problem.
Posted 06 February 2013 - 02:01 PM
#4
Re: Second form item_check event problem.
Posted 06 February 2013 - 02:05 PM
Well without that code here, i can only guess 
I would double check that part.
Quote
But before second form unload the secondForm Checkboxlist itemcheck event occurs.
I would double check that part.
This post has been edited by Michael26: 06 February 2013 - 02:07 PM
#5
Re: Second form item_check event problem.
Posted 06 February 2013 - 02:39 PM
Michael26, on 06 February 2013 - 02:05 PM, said:
Well without that code here, i can only guess
/>/>/>
I would double check that part.
Quote
But before second form unload the secondForm Checkboxlist itemcheck event occurs.
I would double check that part.
Error occurs from second forms method when i call it at constructor. I have a method for checkboxlist which is handling some items checkstate unchecked to checked. How can i prevent it or can i stop execution of checkboxlist itemcheck event at the secondform's constructor?
//second form's state alter method.. calling at constructor.
void SelectedRoomBedTypes()
{
foreach (var item in bedtypes)
{
for (int i = 0; i < clstBedTypes.Items.Count; i++)
{
BedTypes bt = clstBedTypes.Items[i] as BedTypes;
if (bt.ID == item.BedTypeID)
{
clstBedTypes.SetItemChecked(i, true);
}
}
}
}
//clstBedTypes ItemCheck event
BedTypes bt = (BedTypes )clstBedTypes.SelectedItem;
if (e.NewValue == CheckState.Unchecked)
{
RoomBedType r = new RoomBedType();
r.RoomID = _room.ID;//_room object from first form
o.BedTypeID = bt.ID;
MessageBox.Show(YatakTipIslemleri.OdayaGoreYatakTipSil(o));
}
else
{
OdaYatakTip o = new OdaYatakTip();
o.OdaID = _oda.ID;
o.YatakTipID = yt.ID;
MessageBox.Show(BedTypeProc.SaveBedRoomTypeByRoom(o));
}
thanks.
Error occurs from second forms method when i call it at constructor. I have a method for checkboxlist which is handling some items checkstate unchecked to checked. How can i prevent it or can i stop execution of checkboxlist itemcheck event at the secondform's constructor?
//second form's state alter method.. calling at constructor.
void SelectedRoomBedTypes()
{
foreach (var item in bedtypes)
{
for (int i = 0; i < clstBedTypes.Items.Count; i++)
{
BedTypes bt = clstBedTypes.Items[i] as BedTypes;
if (bt.ID == item.BedTypeID)
{
clstBedTypes.SetItemChecked(i, true);
}
}
}
}
//clstBedTypes ItemCheck event
BedTypes bt = (BedTypes )clstBedTypes.SelectedItem;
if (e.NewValue == CheckState.Unchecked)
{
RoomBedType r = new RoomBedType();
r.RoomID = _room.ID;//_room object from first form
r.BedTypeID = bt.ID;
MessageBox.Show(YatakTipIslemleri.OdayaGoreYatakTipSil(o));
}
else
{
RoomBedType r = new RoomBedType ();
r.OdaID = _oda.ID;
r.YatakTipID = yt.ID;
MessageBox.Show(BedTypeProc.SaveBedRoomTypeByRoom(o));
}
thanks.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|