Imports System.Security Imports System.ComponentModel Module Module1 Sub Main() Dim username As String = "MyUser" Dim password As SecureString = ConvertToSecureString("MyPassword") Dim domain As String = "MyDomain" Dim filename As String = "c:\windows\notepad.exe" Try System.Diagnostics.Process.Start(filename, username, password, domain) Catch ex As Win32Exception System.Windows.Forms.MessageBox.Show("Something went wrong!", "Error") End Try End Sub Function ConvertToSecureString(ByVal str As String) Dim password As New SecureString For Each c As Char In str.ToCharArray password.AppendChar(c) Next Return password End Function End Module
Gain unlimited access to on-demand training courses with an Experts Exchange subscription.Get Access
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE
Connect with Certified Experts to gain insight and support on specific technology challenges including: