using System;
using System.IO;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Lumiplex_Cinemas
{
public partial class Booking : UserControl, ISwitchable
{
string movieName;
public Booking()
{
InitializeComponent();
movieName = "Descriptions/miss_peregrines_home_for_peculiar_children.txt";
descriptionTextBox.Text = ReadingDesciptions(movieName);
}
public string ReadingDesciptions(string movieName)
{
//Tried both of these, still the same error
string description = System.IO.File.ReadAllText(movieName);
string description = File.ReadAllText(movieName);
return description;
}
}
}
我試圖顯示文本文件的內容到一個文本框,但要得到一個錯誤說閱讀:WPF C#:從文本文件
「未處理的異常類型的「系統.IO.DirectoryNotFoundException'發生在mscorlib.dll中
附加信息:無法找到部分路徑'C:\ Descriptions \ miss_peregrines_home_for_peculiar_children.txt'。「
對不起,如果我沒有包括你可能需要的一切,我會編輯帖子,如果是這樣的話。
我認爲該文件實際上存在,對嗎? – dasblinkenlight
找不到目錄。您的說明文件夾在您的exe文件夾中? – SAm
聽起來很像「C:\ Descriptions \」不存在... – Mr47