openFileDialog1.ShowDialog
openFileDialog1.filter="yourFiletype(*.yourfiletype)"if openfileDialog1.filename<> "" then
0..........

解决方案 »

  1.   

    using System.IO;
    //
    try
    { string strLine="";
    string id="";//卡号
    bool ok=false;//用户是否按了OK
    bool complete=true;//刷卡是否完毕
    string[]strArray;
    char[]charArray=new char[]{','};
    FileStream aFile=new FileStream("tempid.txt",FileMode.Open);
    StreamReader sr=new StreamReader(aFile);
    strLine=sr.ReadLine();
    if(strLine!=null)
    {
    strArray=strLine.Split(charArray);
    complete=bool.Parse(strArray[2].Trim());
    if(complete)//刷卡完毕
    {
    ok=bool.Parse(strArray[1].Trim());
    if(ok)//用户按下OK
    {
    id=strArray[0].Trim();
    if(id!="000")
    textBoxIDNumber.Text=id;

    }
    timerCheck.Enabled=false;
    }
    }
    sr.Close();
    }
    catch
    {
    //没有文件
    ;
    }