问题描述
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace CoMicrosEditBox
{
public class CoMicrosEditBox: System.Windows.Forms.TextBox
{
{
private List<string> _ColumnHeading = new List<string>();
public List<string> ColumnHeading
{
set { _ColumnHeading = value; }
get { return _ColumnHeading; }
}
}
}
在另一个应用程序中使用此CoMicrosEditBox
时,不能为ColumnHeading
添加值.说System.String
没有构造函数.
但是,如果将字符串替换为int,则可以正常工作.
[edit]转义了<"和>"字符,使代码片段更有意义! -OriginalGriff [/edit]
While using this CoMicrosEditBox
in another application, cannot add values for ColumnHeading
. Saying System.String
doesn''t have contructor.
But if replace string with int, it is working fine.
[edit]''<'' and ''>'' characters escaped to make the code fragment more meaningfull! - OriginalGriff[/edit]
推荐答案
using System.Collections;
并将您的列表设为arraylist
Bcoz列表是通用的
如果要使用通用类型,请定义通用类型"T"
___________________________________________________
问候
纳库尔·昆德拉
(软件开发人员)
and make your list as arraylist
Bcoz list is a generic
if you want to use generic please define the generic type "T"
___________________________________________________
Regards
Nakul Kundra
(Software Developer)
using System.Windows.Forms;
里面没有错误.
There is no error in it.
这篇关于什么是5行代码(C#)中的错误,请帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!