when i run my system in .exe file i got error[unhandled exception has occurred in your application] , i used this code

Public Class Form1
    Declare Function Wow64DisableWow64FsRedirection Lib "kernel32" (ByRef oldvalue As Long) As Boolean
    Declare Function Wow64EnableWow64FsRedirection Lib "kernel32" (ByRef oldvalue As Long) As Boolean
    Private osk As String = "C:\Windows\System32\osk.exe"
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim old As Long
        If Environment.Is64BitOperatingSystem Then
            If Wow64DisableWow64FsRedirection(old) Then
                Process.Start(osk)
                Wow64EnableWow64FsRedirection(old)
            End If
        Else
            Process.Start(osk)
        End If
    End Sub
End Class

Can you find out which line throws the error?

O.K. I just played around with it. In Solution Explorer make sure you have selected Any CPU as target. Then I put, just for testing, this line on top of form1.load:

 Private oskProcess As Process

and just called in form load:

 Process.Start("osk.exe")

which worked fine when running the exe.

@Minimalist, thank you :) , It works now

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.