Skip to content

LIFE designer's BLOG

인생을 설계하는 프로그래머의 블로그

Determine the Executing Application’s Path

Posted on 2006년 7월 20일 By kim7463@gmail.com Determine the Executing Application’s Path에 댓글 없음

HOW TO: Determine the Executing Application’s Path

Applies to:
   Microsoft® .NET Compact Framework 1.0
   Microsoft® Visual Studio® .NET 2003

IN THIS TASK

SUMMARY

    Determine the Executing Application’s Path (VB)

    Determine the Executing Application’s Path (C#)

REFERENCES

SUMMARY

Learn how to determine the path of the currently executing application. In Embedded Visual Basic, the executing application path would be available through App.Path property. The executing application’s path can be determined by examining the executing assembly’s AssemblyName object, which fully describes the assembly’s identity.

Determine the Executing Application’s Path (VB)

  1. Start Microsoft Visual Studio .NET.
  2. Create a new Visual Basic Smart Device Application project named AppPath.
  3. In the Smart Application Wizard, select the Pocket PC platform and Windows Application project type.
  4. Add a Button control to the form. The button is named Button1 by default.
  5. Right-click the form, and then click View Code.
  6. Add the following Click event handler for Button1:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Button1.Click  
Dim path As String  
path = System.IO.Path.GetDirectoryName( _      
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
MessageBox.Show(path)
End Sub

Determine the Executing Application’s Path (C#)

  1. Start Microsoft Visual Studio .NET.
  2. Create a new Visual C# Smart Device Application project named AppPath.
  3. In the Smart Application Wizard, select the Pocket PC platform and Windows Application project type.
  4. Add a Button control to the form. The button is named button1 by default.
  5. Double click button1 to create a Click event handler
  6. Add the following code to the event handler:
    private void button1_Click(object sender, System.EventArgs e){   

    string path;

    path = System.IO.Path.GetDirectoryName(

    System.Reflection.Assembly.GetExecutingAssembly().

    GetName().CodeBase );

    MessageBox.Show( path );

    }

REFERENCES

The Visual Studio .NET 2003 online help.

미분류

글 내비게이션

Previous Post: Where’s my app.path in vb.net
Next Post: SQL CE 사용 Application 배포

답글 남기기 응답 취소

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

최신 글

  • [Vue3] use webpack proxy
  • PCF7953 Read / Write
  • BMW F body Key FOB 케이스 교체
  • BMW
  • Dirty Life
  • Engineer
  • LIFE
  • Software
  • vue3
  • 미분류

Copyright © 2022 LIFE designer's BLOG.

Powered by PressBook WordPress theme