EDN Admin
Well-known member
I have a form that requires an XElement argument,
<pre>public FrmSetSchedule(XElement schedule)
{<br/>
InitializeComponent();
_schedule = schedule;<br/>
System.IO.MemoryStream ms = new System.IO.MemoryStream(Encoding.ASCII.GetBytes(schedule.ToString()));<br/>
scheduler.Storage.Appointments.Items.ReadXml(ms);<br/>
}[/code]
After the user has provided information in the form, the form saves a new XElement value to the _schedule variable.
System.IO.MemoryStream ms = new System.IO.MemoryStream();<br/>
scheduler.Storage.Appointments.Items.WriteXml(ms);
_scheduler = XElement.Parse(Encoding.ASCII.GetString(ms.ToArray()));
The _scheduler variable updates but only locally, when I track the original variable from the FrmSetSchedules Owner
FrmSetSchedule schedule = new FrmSetSchedule(_scheduler);
Now I tried another approach using XElement.ReplaceWith() procedure,
<img src="http://public.blu.livefilestore.com/y1pad1Xq1N7pGECzZ51pzd84abr4K_hqfKtEpkg6VXunMXZ840SQn_mBxKcL1FTzhZ_zqNsi0U3nVC-E-bGhvKVWQ/XElement%20not%20updating.bmp?psid=1" alt="
Result may have changed but not useful to me.
How can I update the original variable, I already tried the ref keyword (new FrmSetSchedule(ref _scheduler) and updated the other code but the same result is rendered.
NOTE: variable scheduler (not _scheduler) is a 3rd party control.
<
The more I study, the more I realize how little I know.
View the full article
<pre>public FrmSetSchedule(XElement schedule)
{<br/>
InitializeComponent();
_schedule = schedule;<br/>
System.IO.MemoryStream ms = new System.IO.MemoryStream(Encoding.ASCII.GetBytes(schedule.ToString()));<br/>
scheduler.Storage.Appointments.Items.ReadXml(ms);<br/>
}[/code]
After the user has provided information in the form, the form saves a new XElement value to the _schedule variable.
System.IO.MemoryStream ms = new System.IO.MemoryStream();<br/>
scheduler.Storage.Appointments.Items.WriteXml(ms);
_scheduler = XElement.Parse(Encoding.ASCII.GetString(ms.ToArray()));
The _scheduler variable updates but only locally, when I track the original variable from the FrmSetSchedules Owner
FrmSetSchedule schedule = new FrmSetSchedule(_scheduler);
Now I tried another approach using XElement.ReplaceWith() procedure,
<img src="http://public.blu.livefilestore.com/y1pad1Xq1N7pGECzZ51pzd84abr4K_hqfKtEpkg6VXunMXZ840SQn_mBxKcL1FTzhZ_zqNsi0U3nVC-E-bGhvKVWQ/XElement%20not%20updating.bmp?psid=1" alt="
Result may have changed but not useful to me.
How can I update the original variable, I already tried the ref keyword (new FrmSetSchedule(ref _scheduler) and updated the other code but the same result is rendered.
NOTE: variable scheduler (not _scheduler) is a 3rd party control.
<
The more I study, the more I realize how little I know.
View the full article