c#打开txt文件并导入到textbox中
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Title = " 请选择您要导入的模板文件:";
openFileDialog.Filter = "TextDocument(*.txt)|*.txt|TextDocument(*.ini)|*.ini";
openFileDialog.ShowDialog();
if (openFileDialog.FileName != "")//判断文件名是否为空
{
StreamReader streamReader = new StreamReader(openFileDialog.FileName, Encoding.Default);
this.txtextBox.Text = streamReader.ReadToEnd();
}
“c#打开txt文件并导入到textbox中” 的相关文章
一、各种旋转、改变大小 注意:先要添加画图相关的using引用。 //向右旋转图像90°代码如下: private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {…
1.Win32Api public class Win32Api { [StructLayout(LayoutKind.Sequential)] public class POINT { public i…
1.工具类代码 using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Windows.Fo…
一、使用线程在窗体中显示进度条 在Winform应用程序中,经常用进度条显示进度信息。这时候就可能用到多线程。如果不采用多线程控制进度条的话,窗口界面很容易假死(无法看到进度信息,看起来像界面卡住了)。 在这个实例中,我们建立一个窗体,窗体中包括一个后台组件,一个进度条控件。当在主窗体中按…