This question already has an answer here:
- Get a new object instance from a Type 12 answers
Getting The following Error...
Error 1 Cannot implicitly convert type 'object' to 'CSV_OOP_Convert.FileConverter'. An explicit conversion exists (are you missing a cast?) \server\UserShares\DBell\VSC\CSV_OOP_Convert\CSV_OOP_Convert\Form1.cs 44 39 CSV_OOP_Convert
String className = cmbConversionAlgorithm.Text;
string namespaceName = "CSV_OOP_Convert";
FileConverter myObj =Activator.CreateInstance(Type.GetType(namespaceName + "." + className));
ConvertFile(myObj);
the cmbConversionAlgorithm contains the the correct name of the class i wish to create an instance of.
it works fine whe i create it normally...
CSV_OOP_Convert.TFConverter tfc = new CSV_OOP_Convert.TFConverter();
Aucun commentaire:
Enregistrer un commentaire