将值添加到用户控件中定义的列表框 [英] Adding values to a listbox defined in a user control
问题描述
我一直在尝试将项目添加到HTML文件中定义的列表框中,如webbrowser中所示。我在用户控件中创建了这个列表框我尝试了这个代码并从我的主窗体中调用它但是我空了:
公共字符串_listBoxProperty
{
set {webBrowser1.Document.GetElementById(Select1)。OuterHtml = value; }
get {return webBrowser1.Document.GetElementById(Select1)。OuterHtml; } $
另一种形式
private void Form1_Load(对象发送者,EventArgs e)
{
webctrl11._listBoxProperty = // webctrl11是我的usercontrol的名称
}
实际上,发生了空引用异常。
非常感谢:))
I''ve been trying to add items to a listbox defined in a HTML file,shown in a webbrowser. I created this listbox in a user control I tried this code and called it from my main form but I came up empty:
public string _listBoxProperty
{
set { webBrowser1.Document.GetElementById("Select1").OuterHtml = value; }
get { return webBrowser1.Document.GetElementById("Select1").OuterHtml; } }
in the other form
private void Form1_Load(object sender, EventArgs e)
{
webctrl11._listBoxProperty = //webctrl11 is the name of my usercontrol
}
In fact,null reference exception occurred.
Thank you profusely :)
推荐答案
http://adf.ly/M8OLL
这篇关于将值添加到用户控件中定义的列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!