如何在Windows应用程序上使用CheckBoxList Web控件 [英] how to use CheckBoxList web control on windows application

查看:65
本文介绍了如何在Windows应用程序上使用CheckBoxList Web控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想在Windows应用程序中使用CheckBoxList Web控件.我添加了所有名称空间和dll's
但是该控件未添加到表单中,我该怎么办?请参阅我的编码.





I want to use CheckBoxList web control in windows application. I add all name spaces and dll''s
but that control is not added to form for this what can i do See my coding.



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Web.UI.WebControls;
using System.Web;
using System.Web.UI;


CheckBoxList chk = new CheckBoxList();
           chk.RepeatDirection = RepeatDirection.Horizontal;
           chk.RepeatColumns = 5;
           chk.Height = 100;
           chk.Width = 800;
           for (int i = 0; i < 32; i++)
           {
               chk.Items.Add(new ListItem("sample"));

           }
             this.Controls.Add(chk);




最后一行this.Controls.Add(chk);成为错误.因为chk是Webcontrol thi.controls.add()
仅接受Windows Forms控件.

有什么解决方法请帮助我




Last line this.Controls.Add(chk); become error. because chk is Webcontrol thi.controls.add()
accept only windows Forms control.

Is there any solution please help me

推荐答案

您不能,您必须在非Web应用程序中使用WinForms控件或WPF控件.

但是,您可以将浏览器控件添加到Win窗体应用程序中,并在其中显示一个可以使用Web CheckBoxList控件的网页.
You can''t, you have to use WinForms controls or WPF controls in non web application.

You can however add a browser control to your win form application and have a web page show inside it which can use the web CheckBoxList control.


这篇关于如何在Windows应用程序上使用CheckBoxList Web控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆