在VB中打印排列/清除/整洁文档

时间:2015-11-04 19:50:29

标签: vb.net document

我必须以特殊格式打印客户输入的信息(见图)。我已经得到它,所以客户可以将信息输入到他们命名的数据库中。我只是不知道如何将其放入图像中所示的特殊格式。我是在代码中还是在文档中执行此操作。

enter image description here

以下是代码:

    Imports System.IO

    Module Module1
    Dim userans As String
    Console.WriteLine("Welcome to this program. Choose weather to view the database or add")
    userans = Console.ReadLine()
    If userans = "add" Then
        Dim objStreamwriter As StreamWriter
        Console.WriteLine("Please type in the name of your new file")
        Dim Myfilename As String = Console.ReadLine()
        objStreamwriter = New StreamWriter("C:\Users\Oliver\Documents\Computing\" + Myfilename + ".txt")
        Dim TextString = "" 'What you are passing to it.
        'Write a line of text to my file defined above
        Console.WriteLine("Enter the data. Type Quit at end")
        Console.WriteLine("Name ")
        Console.Read()
        Console.WriteLine("Adress line and number")
        Console.Read()
        Console.WriteLine("Town")
        Console.Read()
        Console.WriteLine("Postcode")
        Console.Read()


        TextString = Console.ReadLine()
        While TextString <> "Quit"
            objStreamwriter.WriteLine(TextString)
            TextString = Console.ReadLine()
        End While
        'Close the file.
        objStreamwriter.Close()
    End If
    If userans = "view" Then
        Dim objStreamReader As StreamReader
        Dim strLine As String
        Dim filename As String
        Console.WriteLine("Please type in the name of the file to view.")
        filename = Console.ReadLine()
        'Pass the file path and the file name to the StreamReader constructor.
        objStreamReader = New StreamReader("C:\Users\Oliver\Documents\Computing\WriteMrFox.txt")
        'Read the first line of text.
        strLine = objStreamReader.ReadLine
        'Continue to read until you reach the end of the file.
        Do While Not strLine Is Nothing
            'Write the line to the Console window.
            Console.WriteLine(strLine)
            'Read the next line.
            strLine = objStreamReader.ReadLine
        Loop
        objStreamReader.Close()
    End If
End Sub
End Module

0 个答案:

没有答案