Hi
i have created winforms project using the MVC concept in C#.. i created a model which include the method to insert user control captured value from text box and i created a class to set and get the value entered. and created a button in the user control.. my problem is when i click on create button on user control i keep getting null vale from that text box although there are some value entered in the text box:
my method like this
public Route CreateRouteFromText(UCRouteCreate form) { string routecode =form.txtRouteCode.Text; Route route = new Route(); return route; }
my button click event :
private void btnCreateRoute_Click_1(object sender, EventArgs e) { UCRouteCreate form = new UCRouteCreate(); Route route = controller.CreateMovieFromText(form); controller.InsertRoute(route); }
my class for setter and getter:
class Route { public string routeCode ; public string Routecode { get { return routeCode; } set { routeCode = value; } } public Route( ) { }
i do show the the user control from a strip menu click method like this:
private void createRouteToolStripMenuItem_Click(object sender, EventArgs e) { DisplayControl(ucCreateroute); }
my question is when i click on the strip menu button to show the user control do i need to initialize the new shown user control !
and if i can initialize the user control in the method to get the current value in the text box so when i click on create button the insert method should show the new vale instead of null how can i go about doing that as this issue is driving me insane...