StartUp coding problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • antitakumi
    New Member
    • Apr 2008
    • 1

    #1

    StartUp coding problem

    Private Sub CheckBox1_Check edChanged(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles CheckBox1.Check edChanged
    Dim regKey As New Object

    Dim strKeyValueHere As String
    Dim strMyExePathAnd Name As String
    Const strKeyRootPath As String = "SOFTWARE\Micro soft\Windows\Cu rrentVersion\Ru n\"
    Const HKEY_LOCAL_MACH INE As Long = &H80000002
    strKeyValueHere = "MyKey"
    strMyExePathAnd Name = App.Path & "\FYP.Exe"
    If CheckBox1.Check ed = True Then

    If Not regKey.GetKeyVa lue(HKEY_LOCAL_ MACHINE, strKeyRootPath, strKeyValueHere , strMyExePathAnd Name) Then
    regKey.UpdateKe y(HKEY_LOCAL_MA CHINE, strKeyRootPath, strKeyValueHere , strMyExePathAnd Name)
    End If
    End If
    End Sub
    above is my own startup coding. however it got some error about the "Name App is not declared". Is there someone can help me solve the problem?
  • balabaster
    Recognized Expert Contributor
    • Mar 2007
    • 798

    #2
    Originally posted by antitakumi
    strMyExePathAnd Name = App.Path & "\FYP.Exe"
    Try:
    strMyExePathAnd Name = Application.Sta rtupPath & "\FYP.exe"

    Or

    strMyExePathAnd Name = System.Environm ent.CurrentDire ctory & "\FYP.exe"

    One or both of those should do the trick for you...

    Comment

    Working...