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中” 的相关文章
˂span style="margin: 0px; padding: 0px; line-height: 1.5; font-si…
一、各种旋转、改变大小 注意:先要添加画图相关的using引用。 //向右旋转图像90°代码如下: private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {…
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Drawing; using System.Drawing.Drawing2D; using…
在程序中,我们经常使用消息对话框给用户一定的信息提示,如在操作过程中遇到错误或程序异常,经常会使用这种方式给用于以提示。在C#中,MessageBox消息对话框位于System.Windows.Forms命名空间中,一般情况,一个消息对话框包含信息提示文字内容、消息对话框的标题文字、用户响应的按钮及…
很多时候需要邮件发送功能,例如:监测应用,需要上报状态。 微软封装好的MailMessage类:主要处理发送邮件的内容(如:收发人地址、标题、主体、图片等等) 微软封装好的SmtpClient类:主要处理用smtp方式…