I created standard .exe file:
Private Sub Command1_Click()
Dim proxy As Person
Set proxy = New Person 'here get error 70'
proxy.FirstName = "Bejaoui"
proxy.LastName = "Bechir"
proxy.Persist ("D:\myFile.xml")
End Sub
(Person it is class in COM file(.tlb)).
Person.cs in COM file:
using System.Xml.Serialization;
using System.IO;
using System.Runtime.InteropServices;
namespace COM
{
[ClassInterface(ClassInterfaceType.None)]
public class Person : System.EnterpriseServices.ServicedComponent, IPerson
{
public string FirstName { get; set; }
public string LastName { get; set; }
public bool IsMale { get; set; }
public void Persist(string FilePath)
{
StreamWriter oFile = new StreamWriter(FilePath);
XmlSerializer oXmlSerializer = new XmlSerializer(typeof(Person));
oXmlSerializer.Serialize(oFile, this);
oFile.Flush();
oFile.Close();
}
static public Person Retrieve(string FilePath)
{
StreamReader oFile = new StreamReader(FilePath);
XmlSerializer oXmlSerilizer = new XmlSerializer(typeof(Person));
Person oPerson = oXmlSerilizer.Deserialize(oFile) as Person;
return oPerson;
}
}
}
When I touch the button, I get error 70 and it mark string "Set proxy = New Person".
Run .exe in Windows 7
What I did and it didn't help:
- Disable UAC
- Created file myFile.xml
- Changed acces to file "D:\myFile.xml"
- Changed acces to COM file
- Run .exe as a administrator