Reputation: 590
I passed some data from one form to another form. It's ok. but I can't accessed same data from another method in same form. This is the code (i.e :- StDate,EndDate......SDEvening are my data which I passed from an other form.
public frmLeaveRequestConfirmation(DateTime StDate, DateTime EndDate, string SDFull, Boolean SDMorning, Boolean SDEvening)
{
//I can Access those data(StDate,EndDateSDFull......) from here
}
private void RequestLeave()
{
blLeaveManagement bl = new blLeaveManagement();
dalLeaveManagement dal = new dalLeaveManagement();
dal.MyProperty_Exception = "";
dal.MyProperty_LvStartDate = //I want to equal this to StDate;
}
I want to eqaul dal.MyProperty_LvStartDate to StDate. but i can't access to StDate from RequestLeave() method. please somebody give me a solution.
Upvotes: 0
Views: 63
Reputation: 101681
Define a variable to store StDate
, outside of your method:
DateTime stDate;
public frmLeaveRequestConfirmation(DateTime StDate, DateTime EndDate, string SDFull, Boolean SDMorning, Boolean SDEvening)
{
stDate = StDate;
...
}
Then you can access it from your RequestLeave
method.
dal.MyProperty_LvStartDate = stDate;
Upvotes: 1