Welcome on Kweetix Technical Blog

Monday, September 21, 2009

Call a method in another assembly with C#

// Load the assembly

Assembly assembly = Assembly.LoadFrom(@"C:\App\bin\xyz.dll");

// Create the actual type

Type classType = assembly.GetType("xyz", true, false);

// Create an instance of this type and verify that it exists

object dynamicObject = Activator.CreateInstance(classType);

if (dynamicObject != null)
{
// Verify that the method exists and get its MethodInfo object

MethodInfo invokedMethod = classType.GetMethod("Start");

if (invokedMethod != null)
{
object[] parameters = new object[2];
parameters[0] = jobType;
parameters[1] = argument;

// Invoke the method with the parameters

invokedMethod.Invoke(dynamicObject, parameters);
}
}

Wednesday, September 16, 2009

Join workgroup file with Access 2007

1. In Access 2007, open a trusted database, or enable macros in the existing database.

2. Press CTRL+G to open the Immediate window.

3. Type the following line of code, and then press ENTER.
DoCmd.RunCommand acCmdWorkgroupAdministrator

4. In the Workgroup Administrator dialog box, click Join, and then click Browse.

5. Locate and then click the following file, and then click Open:
C:\Program Files\Common Files\system\System.mdw

6. In the Workgroup Administrator dialog box, click OK, and then click Exit

OR

Make a shortcut with the following : "path to 2007msaccess.exe" "path to mdb" /wrkgrp "path to secure.mdw"