Passwords in VNC#

I get a fair bit of mail from people asking how to do their own password dialogs/functions in VNC#. I wrap the password function in a delegate of type AuthenticateDelegate, which takes no arguments and returns a string (i.e., the password). By default I stuff a call to a function that creates and presents a simple password dialog box. But you can substitute your own version, which could pull the password from a database or do something else fancy in your hosting WinForm:

...  
protected RemoteDesktop rd;  
...  
public static string MyPwdFunction()  
{ return "super-secret-P@ssw0rD!"; }  
...  
// somewhere in your ctor or something, before you call connect  
rd = new RemoteDestkop();  
rd.GetPassword = new AuthenticateDelegate(MyPwdFunction);  
...