Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Printing contents of a textbox

BitByBit_ThorBitByBit_Thor Posts: 2,444Member
How do you print a text in a textbox, do I have to write it to a file first?

Thanks in advance

Richard

Comments

  • Sand_Hawk9Sand_Hawk9 Posts: 233Member
    You mean a Textbox control? Draw one on a form and call it txtTest.

    [code]
    Dim strText As String
    ' Write to textbox
    txtTest.Text = "Hello, simple isn't it?
    'Read from textbox
    strText = txtTest.Text
    msgbox strText
    [/code]
    Hope this helped.

    Sand Hawk
    Member of the Stupid Coders
    http://www.stupidcoders.cjb.net

    - Earth is 98% full. Please delete anybody you can.

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : You mean a Textbox control? Draw one on a form and call it txtTest.
    :
    : [code]
    : Dim strText As String
    : ' Write to textbox
    : txtTest.Text = "Hello, simple isn't it?
    : 'Read from textbox
    : strText = txtTest.Text
    : msgbox strText
    : [/code]
    : Hope this helped.
    :
    : Sand Hawk
    : Member of the Stupid Coders
    : http://www.stupidcoders.cjb.net
    :
    : - Earth is 98% full. Please delete anybody you can.
    :
    :

    I meen: How do you send the contents of a textbox to the printer? I want to Print out the text in the textbox? How do I do that without printing out the entire form.

    But thanks anyway!

  • jacob_miwjacob_miw Posts: 194Member

    : I meen: How do you send the contents of a textbox to the printer? I want to Print out the text in the textbox? How do I do that without printing out the entire form.
    :
    : But thanks anyway!
    :
    :

    This should be the way:

    [code]
    Private Sub Command1_Click()
    Printer.Print txtTest.Text
    Printer.EndDoc
    End Sub
    [/code]

    By using the printer object, you can also set the printquality and some other stuff!

    Hope it helps
    jacob[green]_[/green]miw
    ----------
    [italic]ICQ# 56564298[/italic]

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    :
    : : I meen: How do you send the contents of a textbox to the printer? I want to Print out the text in the textbox? How do I do that without printing out the entire form.
    : :
    : : But thanks anyway!
    : :
    : :
    :
    : This should be the way:
    :
    : [code]
    : Private Sub Command1_Click()
    : Printer.Print txtTest.Text
    : Printer.EndDoc
    : End Sub
    : [/code]
    :
    : By using the printer object, you can also set the printquality and some other stuff!
    :
    : Hope it helps
    : jacob[green]_[/green]miw
    : ----------
    : [italic]ICQ# 56564298[/italic]
    :
    :

    Thanks,

    It works. Now I just have to print some bigger letters and add a little bit of white room to the leftside!
  • MalcolmMalcolm Posts: 828Member
    : :
    : : : I meen: How do you send the contents of a textbox to the printer? I want to Print out the text in the textbox? How do I do that without printing out the entire form.
    : : :
    : : : But thanks anyway!
    : : :
    : : :
    : :
    : : This should be the way:
    : :
    : : [code]
    : : Private Sub Command1_Click()
    : : Printer.Print txtTest.Text
    : : Printer.EndDoc
    : : End Sub
    : : [/code]
    : :
    : : By using the printer object, you can also set the printquality and some other stuff!
    : :
    : : Hope it helps
    : : jacob[green]_[/green]miw
    : : ----------
    : : [italic]ICQ# 56564298[/italic]
    : :
    : :
    :
    : Thanks,
    :
    : It works. Now I just have to print some bigger letters and add a little bit of white room to the leftside!
    :

    CurrentX and CurrentY properties are used to set the current print position (You'll need to set these before every print command if you do not want it to print in the next default position.

    You can also use the FontSize and FontBold and FontUnderline and etc properties to change the font style. (I think they are the correct properties for the printer object). With these sorts of properties, it just keeps printing in that font type until you change it.

    For example:

    [code]Printer.CurrentX = 3000
    Printer.CurrentY = 3000
    Printer.FontSize = Text1.FontSize
    Printer.Print = Text1.Text[/code]
  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : : :
    : : : : I meen: How do you send the contents of a textbox to the printer? I want to Print out the text in the textbox? How do I do that without printing out the entire form.
    : : : :
    : : : : But thanks anyway!
    : : : :
    : : : :
    : : :
    : : : This should be the way:
    : : :
    : : : [code]
    : : : Private Sub Command1_Click()
    : : : Printer.Print txtTest.Text
    : : : Printer.EndDoc
    : : : End Sub
    : : : [/code]
    : : :
    : : : By using the printer object, you can also set the printquality and some other stuff!
    : : :
    : : : Hope it helps
    : : : jacob[green]_[/green]miw
    : : : ----------
    : : : [italic]ICQ# 56564298[/italic]
    : : :
    : : :
    : :
    : : Thanks,
    : :
    : : It works. Now I just have to print some bigger letters and add a little bit of white room to the leftside!
    : :
    :
    : CurrentX and CurrentY properties are used to set the current print position (You'll need to set these before every print command if you do not want it to print in the next default position.
    :
    : You can also use the FontSize and FontBold and FontUnderline and etc properties to change the font style. (I think they are the correct properties for the printer object). With these sorts of properties, it just keeps printing in that font type until you change it.
    :
    : For example:
    :
    : [code]Printer.CurrentX = 3000
    : Printer.CurrentY = 3000
    : Printer.FontSize = Text1.FontSize
    : Printer.Print = Text1.Text[/code]
    :


    Thanks for the advice

    (Gee, I seem to be responding to you alot!)
Sign In or Register to comment.