Richtextbox和Savefile [英] Richtextbox and Savefile

查看:51
本文介绍了Richtextbox和Savefile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!

在我的应用程序中,有时会使用richtextbox.savefile创建一个.doc文件.

At some moment in my application I create a .doc file using richtextbox.savefile.

后来我修改了RichTextBox中的文本,并将新内容保存在与上述相同的文件中.

Later I modify the text from my richtextbox and save the new content in the same file as above.

这是我保存的部分:(button.click)

Here is the part were I save it: (button.click)

richTextBoxPrintCtrl1.Text = text_rtb;
 字符串路径= Path.Combine(Path.GetDirectoryName(Application.ExecutablePath),@"Dokumente");
  string numefis = Path.Combine(path,Variabile.nume_fis_incarcat);
  richTextBoxPrintCtrl1.SaveFile(numefis);

 richTextBoxPrintCtrl1.Text = text_rtb;
 string path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"Dokumente");
 string numefis = Path.Combine(path, Variabile.nume_fis_incarcat);
 richTextBoxPrintCtrl1.SaveFile(numefis);

问题是这样的:当我第一次单击按钮时,文件是空的,尽管我的richtextbox肯定有文本.我第二次按下相同的按钮,文件才被写入,但只有那时.

The problem is this: when I first click the button, the file is empty, although my richtextbox definitely has text. The second time I press the same button the file gets written, but only then.

是什么原因造成的?

提前谢谢您,祝你有美好的一天!

Thank you in advance and a nice day!

推荐答案

如果可以调试代码,请仔细阅读,以便在每次单击按钮,您都可以看到要在文件中写入什么值,富文本框的内容是什么.

if you can debugg the code, please go through it so that at each button click you can see what values you are going to write in the file, what are the contents of the rich text box. 

您能看到变量中的值是什么吗? numefis " ?

Can you see what is the value coming in variables "text_rtb" and "numefis" ?

注意

joon


这篇关于Richtextbox和Savefile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆