C#.net中连接问题

来源:百度知道 编辑:UC知道 时间:2024/06/22 23:58:45
System.Environment.GetFolderPath(ApplicationData);
string a =Environment.GetFolderPath(ApplicationData);
int b=a.indexof(":");
string c=left(a,b);

// System.Diagnostics.Process.Start("D:\\test\DataGridDemo\bin\DataGridDemo");
System.Diagnostics.Process.Start(c+":\\3\3");
运行后提示找不到文件,怎么改呢,或者给我一个链接到本地文件的代码,要相对路径的,有追加悬赏
3是我建的工程名字,cs文件在3\3下 ,运行后错误error CS0103: The name 'left' does not exist in the current context
error CS1061: 'string' does not contain a definition for 'indexof' and no extension method 'indexof' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)

使用Application的Path相关属性,如 Application.ExecutablePath

Application.ExecutablePath+@"\3\3";
或 Path.Combine(Application.ExecutablePath,+@"3\3");

int b=a.IndexOf(":");
string c=a.Substring(0,b);

System.Diagnostics.Process.Start(c+":\\3\\3");
或者(c+@":\3\3")不知道你的路径是怎么回事