Home > DeveloperSection > Forums > How to reset user control by getting the value from other form
Chintoo Semi

Total Post:135

Points:947
Posted on    March-26-2014 3:38 AM

 C# C# 
Ratings:


 1 Reply(s)
 643  View(s)
Rate this:

I have form1 : User control and form2: form. I want to reset all the the value from form2 that will effect/reset showing to user control by using reset button. the user control get value from form2

something I tried:

RoomPlan.RoomStatus STATUS = rpRoomPlan[i].roomstatus();

if (STATUS == RoomPlan.RoomStatus.CLEAN)

{

    generateRoomPlan();

    om.IM_RESET_ROOM_STATUS(Convert.ToInt32(ROOMID));

    rpRoomPlan[i].Enabled = true;

    rpRoomPlan[i].BackColor = Color.WhiteSmoke;

}

om.IM_RESET_ROOM_STATUS is the web service *

  case RoomStatus.CLEAN:

if (!string.IsNullOrEmpty(dr["ROOMID"].ToString())){

  updateRoomDisplay(Color.DeepSkyBlue, Color.DeepSkyBlue, Color.LimeGreen,

                                        "BOOK", "ASSIGNED", "", Color.White, Color.WhiteSmoke, Color.WhiteSmoke, "", "", true);}

when we click the reset button then the status BOOK ASSIGNED will change to BOOK UNASSIGN



Pravesh Singh

Total Post:411

Points:2881
Posted on    March-26-2014 4:14 AM

Hi Chintoo,

You can reset the form by simply calling it's designer's InitializeComponent() method. It's private by default, so create another public one:

public void ResetForm()

{

  InitializeComponent();

}

and then call it

form2.ResetForm();


Don't want to miss updates? Please click the below button!

Follow MindStick