I am willing to set the value of the checkbox control (defined in the html file and user control) from the form that contains my usercontrol
The related code in user control:
public bool _checkBoxProperty { set { if (webBrowser1.Document != null && webBrowser1.Document.GetElementById("Checkbox1") != null) { bool s = false; string chpro = webBrowser1.Document.GetElementById("Checkbox1").GetAttribute("checked").ToString(); if (chpro == "false") s = false; s = value; webBrowser1.Document.GetElementById("Checkbox1").SetAttribute("checked", value.ToString()); } } get { if (webBrowser1.Document != null && webBrowser1.Document.GetElementById("Checkbox1") != null) { { string bls = webBrowser1.Document.GetElementById("Checkbox1").GetAttribute("checked"); return Convert.ToBoolean(bls); } } else return false; } }
this piece of code brings the checkbox property in my form and I can set its value,but when I run the program it resets itself to null,
I've been working on this piece of code for days and I fully appreciate some help :)
pedramPosted Apr 4, 2013, 3:44 AM
here is the code in case someone needs it
usercontrol: