How to implement C# multicast delegates in VB - events

Unfortunately the online free translators are unable to convert the following code:
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainAssemblyResolve;
I need the vb.net RaiseEvent equivalent syntax for this.
Many thanks

AddHandler
AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf CurrentDomainAssemblyResolve

Related

vbscript to get email address and subject of sender in excel

I am very new to vbscript. My task is to create an excel sheet whenever the new mail comes in . I just want new excel and it should have only 2 fields Subject and Sender. That too only the most recent record .
Any help in this direction is really appreciated
To handle new mail items you can handle the NewMailEx event of the Application class or just create a rule and then assign a macro sub to run when the rule is triggered. The VBA macro should look like the following one:
public sub test(mail as MailItem)
' do whatever you need
end sub
Then you can automate Excel to get the job done. I'd suggest starting from the Getting Started with VBA in Outlook 2010 article in MSDN.

NetOffice to add a custom form field in outlook new mail window

Problem : I am not able to find a solution to add a custom form field in outlook new mail window. I am using NetOffice and so far I have implemented to use user accounts from outlook.
Required guidance as how to add a custom drop-down button with custom text right under the send mail button.
Thanks in advance.
Cheers!
Farhan
I believe that in net office you need to declare a variable to the MAPI folder relevant to the form you want to start altering, and then go through the folder's View collection. A good start that was done in VBA can be found here:
http://www.vbforums.com/showthread.php?492714-RESOLVED-Outlook-Programmatically-add-user-defined-field
This link detailed the making of a custom field, and then adding it to the appropriate folder view default form. You can easily adapt the VBA code in the above link to NetOffice, since it uses the same methods step-through, such as
dim _outlookapplication as Outlook.Application
dim olNamespace as Outlook._Namespace = _outlookapplication.GetNameSpace("MAPI")
dim olFolder as Outlook.Folder = olNamespace.GetDefaultFolder(olDefaultFolders.olFolderContacts)
dim olView as Outlook.View
Good luck!

Object Does Not Source Automation Events

I am getting "Object Does Not Source Automation Events "
on the following VB 6.0 line
Public WithEvents conn As Connection
Please Help
Maybe you have another class called Connection? From another library or from your own code? I assume you want an ADO connection, try forcing it
Public WithEvents conn As ADODB.Connection

Disable Images, ActiveX Etc in VB6 WebBrowser control using DLCTL_NO_

Like the title says, i want to disable images, and ActiveX Controls in the vb6 webbrowser control using DLCTL_NO_RUNACTIVEXCTLS and DLCTL_NO_DLACTIVEXCTLS
Microsoft talk about it here: http://msdn.microsoft.com/en-us/library/aa741313.aspx
But i dont see any way to access IDispatch::Invoke from the vb6 application.
Any help would be greatly appreciated.
I do not think VB6 let you to add the ambient properties. Try host the ActiveX in another container (e.g. an ActiveX host written by yourself - but I do not know how much time you want to invest to declare VB-friendly OLE interfaces and implement them - or use another ActiveX like the one at http://www.codeproject.com/KB/atl/vbmhwb.aspx instead.
You don't access IDispatch::Invoke in VB6, you just write you method and IDispatch is automagically implemented.
Public Function DlControl() As Long
DlControl = DLCTL_NO_DLACTIVEXCTLS Or ...
End FUnction
Then just open Tools->Procedure Attributes and for DlControl function open Advanced and assign Procedure ID to -5512 (DISPID_AMBIENT_DLCONTROL). That's first part.
Second part is to set the client site to you custom implementation of IOleClientSite. You'll need a custom typelib, try Edanmo's OLELIB for declaration of these interfaces.
Here is a delphi sample how to hook your implementation of IOleClientSite. Apparently you'll alse have to call OnAmbientPropertyChange at some point.

Explicit interface implementation and Reflection.Emit

Does anybody know how to implement an interface's property explicitly
using Reflection.Emit?
See the MSDN documentation for TypeBuilder.DefineMethodOverride, which includes an example of using Reflection.Emit to generate an explicit interface implementation using that method.
This Reflector Addin should help you. It translates the IL code of a given method into the C# code that would be needed to generate the same IL code using System.Reflection.Emit.

Resources