I get the error as a "constructor by type". System.string "cannot find" for user control in C #?

For usercontrol TextBox, I create properties such as AutoCompleteCustomSource , AutoCompleteMode and AutoCompleteSource :

 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 create like this, but I get an error like this for the AutoCompleteCustomSource string collection. i will show you a mistake enter image description here

and what I want, I show in the image below

enter image description here

+4
source share
1 answer

Please try this, I hope this works:

 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); } } 
+1
source

Source: https://habr.com/ru/post/1482510/


All Articles