Click here to Skip to main content
15,897,891 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Invoking a Button_Click() event from a seperate form Pin
Dave Kreskowiak18-Jul-07 10:19
mveDave Kreskowiak18-Jul-07 10:19 
GeneralRe: Invoking a Button_Click() event from a seperate form Pin
nlarson1118-Jul-07 10:21
nlarson1118-Jul-07 10:21 
AnswerRe: Invoking a Button_Click() event from a seperate form Pin
Naji El Kotob18-Jul-07 11:27
Naji El Kotob18-Jul-07 11:27 
Questionhow to Run application developed in VB.Net 2005 on Linux or Mac X Pin
Rizwan Bashir18-Jul-07 4:51
Rizwan Bashir18-Jul-07 4:51 
AnswerRe: how to Run application developed in VB.Net 2005 on Linux or Mac X Pin
originSH18-Jul-07 5:53
originSH18-Jul-07 5:53 
AnswerRe: how to Run application developed in VB.Net 2005 on Linux or Mac X Pin
Dave Kreskowiak18-Jul-07 5:59
mveDave Kreskowiak18-Jul-07 5:59 
QuestionHow to create Folder when you do not have rights but have admin userName and pwd Pin
Rizwan Bashir18-Jul-07 3:57
Rizwan Bashir18-Jul-07 3:57 
AnswerRe: How to create Folder when you do not have rights but have admin userName and pwd Pin
SHatchard18-Jul-07 4:13
SHatchard18-Jul-07 4:13 
Found this code, its not tested but gives you a pointer in imperonating another user.

Imports System
Imports System.Runtime.InteropServices
Imports System.Security.Principal
Imports System.Security.Permissions

<Assembly:SecurityPermissionAttribute(SecurityAction.RequestMinimum,
UnmanagedCode := true)>
Public Class Impersonation

<DllImport("C:\\WINNT\\System32\\advapi32.dll")> _
Public Shared Function LogonUser(lpszUsername As String, lpszDomain As
String, lpszPassword As String, _
dwLogonType As Integer, dwLogonProvider As Integer, ByRef
phToken As Integer) As Boolean
End Function

<DllImport("C:\\WINNT\\System32\\Kernel32.dll")> _
Public Shared Function GetLastError() As Integer
End Function

Public Shared Sub Main(args() As String)

'The Windows NT user token.
Dim token1 As Integer

'Get the user token for the specified user, machine, and password
using the unmanaged LogonUser method.

'The parameters for LogonUser are the user name, computer name,
password,
'Logon type (LOGON32_LOGON_NETWORK_CLEARTEXT), Logon provider
(LOGON32_PROVIDER_DEFAULT),
'and user token.
Dim loggedOn As Boolean = LogonUser("bob", "AARDVARK", "coffee", 3, 0,
token1)
Console.WriteLine("LogonUser called")

'Call GetLastError to try to determine why logon failed if it did not
succeed.
Dim ret As Integer = GetLastError()

Console.WriteLine("LogonUser Success? " + loggedOn)
Console.WriteLine("NT Token Value: " + token1)
If ret <> 0 Then
Console.WriteLine("Error code (126 == ""Specified module could not
be found""): " + ret)
End If

'Starting impersonation here:
Console.WriteLine("Before impersonation:")
Dim mWI1 As WindowsIdentity = WindowsIdentity.GetCurrent()
Console.WriteLine(mWI1.Name)
Console.WriteLine(mWI1.Token)

Dim token2 As IntPtr = new IntPtr(token1)

Console.WriteLine("New identity created:")
Dim mWI2 As WindowsIdentity = new WindowsIdentity(token2)
Console.WriteLine(mWI2.Name)
Console.WriteLine(mWI2.Token)

'Impersonate the user.
Dim mWIC As WindowsImpersonationContext = mWI2.Impersonate()

Console.WriteLine("After impersonation:")
Dim mWI3 As WindowsIdentity = WindowsIdentity.GetCurrent()
Console.WriteLine(mWI3.Name)
Console.WriteLine(mWI3.Token)

'Revert to previous identity.
mWIC.Undo()

Console.WriteLine("After impersonation is reverted:")
Dim mWI4 As WindowsIdentity = WindowsIdentity.GetCurrent()
Console.WriteLine(mWI4.Name)
Console.WriteLine(mWI4.Token)
End Sub
End Class

GeneralRe: How to create Folder when you do not have rights but have admin userName and pwd Pin
Rizwan Bashir18-Jul-07 4:45
Rizwan Bashir18-Jul-07 4:45 
QuestionSuspend binding on a datagridview Pin
steve_rm18-Jul-07 2:55
steve_rm18-Jul-07 2:55 
AnswerRe: Suspend binding on a datagridview Pin
Kschuler18-Jul-07 9:28
Kschuler18-Jul-07 9:28 
QuestionRe: Suspend binding on a datagridview Pin
steve_rm18-Jul-07 22:11
steve_rm18-Jul-07 22:11 
Questionregarding help files Pin
jamesmani2k518-Jul-07 2:29
jamesmani2k518-Jul-07 2:29 
AnswerRe: regarding help files Pin
Naji El Kotob18-Jul-07 2:53
Naji El Kotob18-Jul-07 2:53 
QuestionIncorrect format Pin
boyindie18-Jul-07 2:23
boyindie18-Jul-07 2:23 
AnswerRe: Incorrect format Pin
boyindie18-Jul-07 2:59
boyindie18-Jul-07 2:59 
Questioncant find the query builder Pin
iain659418-Jul-07 1:20
iain659418-Jul-07 1:20 
AnswerRe: cant find the query builder Pin
Dave Kreskowiak18-Jul-07 4:43
mveDave Kreskowiak18-Jul-07 4:43 
Questioncontroling forms Pin
navyasri18-Jul-07 0:54
navyasri18-Jul-07 0:54 
QuestionRe: controling forms Pin
Nilesh Hapse18-Jul-07 0:59
Nilesh Hapse18-Jul-07 0:59 
AnswerRe: controling forms Pin
Jayesh Talsaniya18-Jul-07 2:13
Jayesh Talsaniya18-Jul-07 2:13 
AnswerRe: controling forms Pin
Naji El Kotob18-Jul-07 2:39
Naji El Kotob18-Jul-07 2:39 
QuestionHow can i use MS forms2 Combobox in VB 2005 Pin
Kashif Haqqani18-Jul-07 0:08
Kashif Haqqani18-Jul-07 0:08 
AnswerRe: How can i use MS forms2 Combobox in VB 2005 Pin
Naji El Kotob18-Jul-07 0:36
Naji El Kotob18-Jul-07 0:36 
GeneralRe: How can i use MS forms2 Combobox in VB 2005 Pin
Kashif Haqqani20-Jul-07 0:48
Kashif Haqqani20-Jul-07 0:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.