C# 建立全域變數及全域函式
public struct basPublic{
public static string strTest;
public static int intTest;
public static string AppPath()
{
return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase).Substring(6);
}
}
使用方法
private void frmMain_Load(object sender, EventArgs e)
{
basPublic.strTest = "輸入文字";
basPublic.intTest = 1000;
MessageBox.Show(basPublic.AppPath());
}
頁:
[1]