本文介绍了从VB8Express程序中的RTF文本框中打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你怎么样?
推荐答案
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Text = "Load"
Button2.Text = "Save"
End Sub
'The code to LOAD text to RichTextBox1.>>
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ofd As New OpenFileDialog
ofd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
ofd.Filter = "Text files|*.txt"
Dim result As DialogResult = ofd.ShowDialog
If result = Windows.Forms.DialogResult.OK Then
If (ofd.FileName IsNot Nothing) Or (ofd.FileName <> String.Empty) Then
Using sr As New System.IO.StreamReader(ofd.FileName)
RichTextBox1.Text = sr.ReadToEnd
sr.Close()
End Using
End If
End If
End Sub
'Code to SAVE the text from RichTextBox1.>>
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim sfd As New SaveFileDialog
sfd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
sfd.Filter = "Text files|*.txt"
Dim result As DialogResult = sfd.ShowDialog
If result = Windows.Forms.DialogResult.OK Then
If (sfd.FileName IsNot Nothing) Or (sfd.FileName <> String.Empty) Then
Using sw As New System.IO.StreamWriter(sfd.FileName)
sw.Write(RichTextBox1.Text)
sw.Close()
End Using
End If
End If
End Sub
End Class
不确定您的问题
使用此代码和telme
not sure your question
use this code and telme
这篇关于从VB8Express程序中的RTF文本框中打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!