Printing a textboxes data

ExpoSport

Member
Joined
Jun 6, 2009
Messages
12
Programming Experience
Beginner
first off, i am sorry if this isnt in the right section.
secondly, i searched and searched but could not find a topic to help me. part of me thinks my question is so simple and easy, then from what i've read, i am starting to think it's not quite as easy? but i am very new to visual basic and i havent found anything to help, so i will ask.

but basically what i am trying to do is print a paper copy of the information that i have in my text boxes. i have 17 text boxes i would like to print. if i can do that first, i'd be very happy. after that i'll ask about locations and sizes and fonts and whatnot.

2 names of my text boxes are:

xTuningFreq &
xNetVolume

i am not sure of the commands and/or procedures needed to get anything to print. if anyone can help it'd be greatly appreciated :D
 
thanks for that link. that opened me up to some things. but i think it's just over my head atm. only one semester of college into VBA. some links were to print pictures, or files already on the PC. i'm just lookin to print some text boxes. but thanks anyways!

i can now at least work on a save/open menu bar to save data :) from lookin at other links
 
Printing text is done with the Graphics.DrawString method.
 
i found an example that prints a red rectangle, but cant figure out how to print a textbox
VB.NET:
    Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
        e.Graphics.FillEllipse(Brushes.Blue, New Rectangle(100, 150, 250, 250))
    End Sub
that prints a textbox, how would i print a textbox with the name 'xportlength' for example?
 
' Draws the string within the bounds of the page
e.Graphics.DrawString(stringToPrint, Me.Font, Brushes.Black, _
e.MarginBounds, StringFormat.GenericTypographic)
Would this help you? It's from the "print text" example linked to. The text string in the textbox you can get from Text property.
 
Create an instance of the Font Class (System.Drawing) (follow to "how to: construct" if you need to)
Remember to Dispose it when done using the Font object you created.
 
so i looked through the pages a few times. i saw one that would increase the size on the windows application itself, which i did not need. i found this which i thought might be something:
VB.NET:
Dim fontFamily As New FontFamily("Arial")
Dim font As New Font( _
   fontFamily, _
   16, _
   FontStyle.Regular, _
   GraphicsUnit.Pixel)
is that onto something? i added it to the program but the sizes didnt change when printed. not sure if anything else needs to be changed or not
 
You're not using this font with the DrawString call then?
 
bah ok that was much easier than i was making it out to be. but yes i was using the drawstring method. i put this before that
VB.NET:
Dim drawFont As New Font("Arial", 20)
and that's all it took :) thanks again
 
Back
Top