vb.net一行一行打印的簡單介紹

vb.net怎么從文本文檔中讀取一行數(shù)據(jù),將文本輸出到控制臺?

以下示例一次從文件中讀取一行,然后將每行文本打印到控制臺。

創(chuàng)新互聯(lián)是一家專業(yè)提供老城企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站制作、成都網(wǎng)站設(shè)計、成都h5網(wǎng)站建設(shè)、小程序制作等業(yè)務(wù)。10年已為老城眾多企業(yè)、政府機構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站制作公司優(yōu)惠進行中。

Sub ReadTextLinesFromFile()

Dim file As New System.IO.StreamReader("c:test.txt")

Dim oneLine As String

oneLine = file.ReadLine()

While (oneLine "")

Console.WriteLine(oneLine)

oneLine = file.ReadLine()

End While

file.Close()

End Sub

高分求解vb.net 打印的問題

報表打印應(yīng)該也能實現(xiàn),但是我覺得你這個用文本打印更簡單,將數(shù)據(jù)輸出到txt文件,結(jié)果用RichTextBox顯示,但是需要簡單的排版,調(diào)用打印機打印RichTextBox即可的

排版用tab()、space()、vbcrlf或PrintLine(1)換行,代碼類似如下樣式

PrintLine(1, TAB(60), "準考證" )

PrintLine(1)

PrintLine(1, "姓名:" xingming Space(3) "準考證號:" cel(1) Space(3) cel(2) Space(3) cel(3))

但是TAB()排版比較規(guī)整

打印代碼類似如下:

PrintDialog1.Document = PrintDocument1

PrintDocument1.DocumentName = "準考證"

PrintDialog1.AllowSomePages = False

PrintDialog1.ShowHelp = False

PrintDialog1.ShowNetwork = False

PrintDialog1.AllowSelection = False

PrintDialog1.AllowPrintToFile = False

MySReader = New StringReader(RichTextBox1.Text)

stringToPrint = MySReader.ReadToEnd()

PageSetupDialog1.Document = PrintDocument1

PageSetupDialog1.PageSettings.Margins.Bottom = 50

PageSetupDialog1.PageSettings.Margins.Top = 50

PageSetupDialog1.PageSettings.Margins.Left = 50

PageSetupDialog1.PageSettings.Margins.Right = 50

If PageSetupDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then

PrintDocument1.DefaultPageSettings = PageSetupDialog1.PageSettings '頁面設(shè)置

If PrintDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then

If PrintDialog1.PrinterSettings.IsValid = True Then

PrintDocument1.Print()

MsgBox("打印完成!" vbCrLf "Print completed!", , "Print hint(打印提示)")

Else

MsgBox("打印失?。〈蛴C不可用。" vbCrLf "Print failed! The printer is not valid.", , "Print hint(打印提示)")

End If

Else

Exit Sub

End If

End If

我想要在VB 打印一行數(shù)據(jù)分次打印,也就是在一行上打印時用循環(huán)三次的方法去打怎樣實現(xiàn)?請教高手,非常感

一行數(shù)據(jù)分三次打印 那你一行數(shù)據(jù)里面有沒有特殊符號 還是只需要一行分三次打印出來

vb.net Document_PrintPage打印多行文本

比如:

Private Sub Document_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)

e.Graphics.DrawString(str0, New Font("Arial", 14, FontStyle.Regular), Brushes.Black, 50, 50)

e.Graphics.DrawString(A1, New Font("Arial", 10, FontStyle.Regular), Brushes.Black,50, 100)

e.Graphics.DrawString(A2, New Font("Arial", 10, FontStyle.Regular), Brushes.Black, 300,100)

e.Graphics.DrawString(A3, New Font("Arial", 10, FontStyle.Regular), Brushes.Black, 800,100)

也就是分次用不同坐標和不同的字體來打印各變量。畫線用:

e.Graphics.DrawLine(BlackPen, x1, y1, x2, y2)。

具體坐標數(shù)值自己用尺量出,再換算。

本文標題:vb.net一行一行打印的簡單介紹
轉(zhuǎn)載注明:http://muchs.cn/article16/hjdjdg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作標簽優(yōu)化、網(wǎng)站設(shè)計公司做網(wǎng)站、網(wǎng)站設(shè)計移動網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

手機網(wǎng)站建設(shè)