jeudi 18 juillet 2019

Import Export of control Properties using PropertyInfo[]

My question is simple. I am using a Label control. I created a label at runtime and then I save all its properties using PropertyInfo[] to a Textfile.

Now I again want to recreate this label at runtime using those settings in file but it always gives error on some settings like fonts, size and others.

Please share a sample code with me in which 1.I can create a Label at runtime 2.Then save its settings in Textfile 3.And then recreate it from that Textfile

Label _lbl = new Label();
Type t = typeof(Label);
PropertyInfo[] propInfos = t.GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (PropertyInfo info in propInfos)
{
  //exporting settings to file
}





Aucun commentaire:

Enregistrer un commentaire