Thursday 26 January 2012

input text from user and print in file


below code is for input text from user like text box or reach text box and print  these file directly.


Imports System.Drawing.Printing
Imports System.Windows.Forms.PictureBox
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
    Private Sub write_bill1()

        FileOpen(1, "c:\new folder\bill\tmp.doc", OpenMode.Output)   ' Open file for output.

        MessageBox.Show("Please click time only")
        Print(1, "------------------------------------------------------")   ' Print text to file.
        PrintLine(1)   ' Print blank line to file.
        PrintLine(1, "Name", SPC(16), TextBox1.Text)   ' Print in two print zones.
        PrintLine(1, "Address", SPC(13), TextBox2.Text)   ' Separate strings with a tab.
        PrintLine(1, "Contect number", SPC(6), TextBox3.Text)
        PrintLine(10, "--------------------------------------------------")

        Print(1, "           ")
        'PrintLine(1, SPC(5), "5 leading spaces ")   ' Print five leading spaces.
        'PrintLine(1, TAB(10), "Hello")   ' Print word at column 10.
        ' Assign Boolean, Date, and Error values.
        'Dim aBool As Boolean
        Dim aDate As DateTime
        'aBool = False
        aDate = DateTime.Today



        FileClose(1)   ' Close file.
    End Sub
    Private MyImage As Bitmap
    Public Sub ShowMyImage(ByVal fileToDisplay As String, ByVal xSize As Integer, _
    ByVal ySize As Integer)
        ' Sets up an image object to be displayed.
        If (MyImage IsNot Nothing) Then
            MyImage.Dispose()
        End If
        PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
        MyImage = New Bitmap(fileToDisplay)
        PictureBox1.ClientSize = New Size(xSize, ySize)
        PictureBox1.Image = CType(MyImage, Image)
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        write_bill1()
    End Sub
End Class

No comments:

Post a Comment