VB.NET在Richtextbox中添加分隔线 [英] VB.NET Add separator line in Richtextbox

查看:422
本文介绍了VB.NET在Richtextbox中添加分隔线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在循环读取文本文件到我的富文本框中.
我想在每行文本之后添加分隔线.

Hello, i am reading a text file in a loop into my rich text box.
I want to add a separator line after each line of text.

Dim URL As String = strChatSite & "/File.txt"
      Dim request As WebRequest = WebRequest.Create(URL)
      Dim response As WebResponse = request.GetResponse()
      Dim reader As StreamReader = New StreamReader(response.GetResponseStream())
      txtC.Text = reader.ReadToEnd




如何在富文本框中执行此操作?

谢谢




How can i do that in a rich text box?

Thanks

推荐答案

您必须遍历整个流并将其解析为单独的行.根据.txt文件中的换行符,您可以将整个流的ReadToEnd放到一个String变量中,然后调用替换为并将换行符替换为Environment .NewLine.
You have to go through the entire stream and parse it up into individual lines. Depending on the line break character(s) that are in the .txt file, you may just get away with ReadToEnd the entire stream into a String variable, then just call Replace on it with and replace the line break character(s) with Environment.NewLine.


这篇关于VB.NET在Richtextbox中添加分隔线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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