Version Française
Search Stories : Publier Votre Article
> Constructor of type system.string not found (Design Time error) <
Published on 12/04/2008 By Malek Chtioui (Xcess)
When using a property grid in a .NET project (with custom server controls too) the message constructor of type system.string not found can occur on the design mode.

To solve that, add this line on the top of your property :

[Editor("System.Windows.Forms.Design.StringCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))]

Exemple :
       
        private System.Collections.Generic.List<string> _Ilist;

        [Editor("System.Windows.Forms.Design.StringCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))]
        public System.Collections.Generic.List<string> Files_List
        {
            get
            {
                return _Ilist;
            }
            set
            {
                _Ilist = value;
            }
        }
 Comments : Publish your article
re: Constructor of type system.string not found
By Fred, Date: 12/04/2008
does anybody know how to have a property that contains a list of files (with the browse '...' at design time)
Re: fred
By Xcess (malek), Date: 12/04/2008
Hello, yes Fred :

[PersistenceMode(PersistenceMode.InnerProperty), DefaultProperty("FileName")]
public class File
{
public File()
{
}

public File(string File_Name)
{
FileName = File_Name;
}

private string _fname = "";

[Bindable(true)]
[DefaultValue("")]
[Localizable(true)]
[Editor(typeof(System.Web.UI.Design.UrlEditor), typeof(System.Drawing.Design.UITypeEditor))]
public string FileName
{
get { return _fname; }
set { _fname = value; }
}
}

public class MM_FileNames : CollectionBase
{
public File this[int index]
{
get { return ((File)(List[index])); }
set { List[index] = value; }
}
public int Add(File item)
{
return List.Add(item);
}

public void Insert(int index, File item)
{
List.Insert(index, item);
}
}


use MM_FileNames in your class as a public property like this :


private MM_FileNames _XFN = new MM_FileNames();
[NotifyParentProperty(true)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public MM_FileNames Files_List
{
get { return _XFN; }
}
 Add your Comment :
Your Name :
Email :
   * Email address will be hidden.
Title :
Comment :
Advertising
Try XcessColorPicker
Other articles
Mahdia, Tunisia
 By Xcess, Date : 23/01/2007
Tozeur, Tunisia
 By Xcess, Date : 23/01/2007
Pharo Tours (Egypt and worldwide tour packages)
 By Pharo Tours, Date : 20/01/2008
When is the next PageRank Update?
 By Malek Chtioui, Date : 14/06/2007
Lybia Travel Agents
 By Houda Mansour, Date : 31/05/2007
Top 5
A Program That Can Fix Dead Pixels On Your LCD Screen.
 By Malek Chtioui, Date : 14/06/2007
Unlock your Nokia phone online for FREE.
 By Xcess, Date : 01/04/2007
5 Ways To Convert Anything to Anything
 By Malek Chtioui, Date : 22/06/2007
Pictures of Dubai, a New City In Full Expansion
 By Malek Chtioui, Date : 12/06/2007
Lybia Travel Agents
 By Houda Mansour, Date : 31/05/2007
Xcess Company, Adress : Xcess Company S.A.R.L., Boulevard Aïcha Bent Abi Backer, Khézama 3, Sousse, Tunisia.
Phone : (+216) 98 29 2345 , Fax : (+216) 73 276 669 , VAT : 413587L/M/B/000 , Email/MSN : mail@xcess.info