简体   繁体   English

对于C#中的用户控件,我收到的错误就像“类型'上的构造函数'system.string'找不到”?

[英]I am getting error like “constructor on type 'system.string' cannot found” for a User Control in C#?

For a usercontrol TextBox i am creating properties like AutoCompleteCustomSource , AutoCompleteMode and AutoCompleteSource : 对于usercontrol TextBox,我正在创建AutoCompleteCustomSourceAutoCompleteModeAutoCompleteSource等属性:

public virtual AutoCompleteStringCollection AutoCompleteCustomSource 
{ 
    get { return txtLocl.AutoCompleteCustomSource; } 
    set { txtLocl.AutoCompleteCustomSource = value; } 
}

public virtual AutoCompleteMode AutoCompleteMode 
{ 
    get { return txtLocl.AutoCompleteMode; } 
    set { txtLocl.AutoCompleteMode = value; } 
}

public virtual AutoCompleteSource AutoCompleteSource 
{ 
    get { return txtLocl.AutoCompleteSource; } 
    set {txtLocl.AutoCompleteSource=value;} 
}

I am creating like that but i am getting error like this for AutoCompleteCustomSource string collection. 我正在创建这样的但是我收到这样的AutoCompleteCustomSource字符串集合的错误。 i show you the error 我告诉你错误 在此输入图像描述

and what i want is i show in the below figure 我想要的是我在下图中显示

在此输入图像描述

Please try this, I hope it will work: 请试试这个,我希望它会起作用:

public string[] AutoCompleteCustomSource
{
    get
    {
        List<string> lStringList = new List<string>();
        foreach (string lval in this.mEkaTextBox.AutoCompleteCustomSource)
        {
            lStringList.Add(lval);
        }
        return lStringList.ToArray();
    }
    set
    {
        txtLocl.AutoCompleteCustomSource.AddRange(value);
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#中的System.String类型 - System.String Type in C# 尝试解析JSON响应时出现错误-无法将类型为&#39;System.String&#39;的对象转换为类型&#39;&#39; - Getting error when trying to parse JSON Response - Cannot convert object of type 'System.String' to type '' 数据绑定到用户控件错误 Data.Binding 无法转换为 System.String - Data Binding to User Control Error Data.Binding cannot be converted to System.String C# 中的 MS Word 自动化 - 无法将类型为“System.String[*]”的 object 转换为类型“System.String[]” - MS Word Automation in C# - Unable to cast object of type 'System.String[*]' to type 'System.String[]' 使用 Newtonsoft.Json 反序列化 C# 对象时出错:将值“xxx”转换为类型“System.String[]”时出错 - Error on deserializing C# object with Newtonsoft.Json: Error converting value “xxx” to type 'System.String[]' C# 当我链接到 dll - C# get error Method not found :System.Security.AccessControl.FileSecurity System.IO.File.GetAccessControl(System.String) when I link to dll C# 中未定义或导入预定义类型“System.String” - Predefined type 'System.String' is not defined or imported in C# 获取错误类型&#39;System.String&#39;不支持数组反序列化 - Getting error Type 'System.String' is not supported for deserialization of an array System.String [*]和System.String [] C#的区别 - System.String[*] and System.String[] Difference in C# IdentityServer4 无法在 Azure 中启动错误无法创建类型为“System.String”的实例,因为它缺少公共无参数构造函数 - IdentityServer4 Fails to start in Azure error Cannot create instance of type 'System.String' because it is missing a public parameterless constructor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM