|
-
Dec 7th, 2009, 06:47 AM
#1
Thread Starter
Junior Member
[RESOLVED] Display text file in frame
I have a form and I want to display a text file inside a frame in the form ... Outside the frame , I want to give a print button pressing which we can print the text file ... Please help .... how can I do it ?? Thanks in Advance ....
-
Dec 7th, 2009, 06:49 AM
#2
Re: Display text file in frame
Put a textbox in the frame, open the text file in the textbox then print the contents of the textbox.
-
Dec 7th, 2009, 06:58 AM
#3
Thread Starter
Junior Member
Re: Display text file in frame
but how to open the file in a text box ?? I am using the datasource property but it is not working ...
-
Dec 7th, 2009, 07:04 AM
#4
Re: Display text file in frame
No no...you don't need to use a property...write the code
vb Code:
Open "c:\rahulpgr.txt" For Input As #1
Text1.Text = Input(LOF(1), 1)
Close #1
-
Dec 7th, 2009, 07:08 AM
#5
Thread Starter
Junior Member
Re: Display text file in frame
A problem is occurring ... the display is not same as in text file ... all lines are displayed in a single line and newline is displayed as ||
-
Dec 7th, 2009, 07:12 AM
#6
Re: Display text file in frame
Set the Multiline to True in the textbox property page.
-
Dec 7th, 2009, 07:13 AM
#7
Re: Display text file in frame
 Originally Posted by rahulpqr
A problem is occurring ... the display is not same as in text file ... all lines are displayed in a single line and newline is displayed as ||
Set the TextBox.MultiLine property to True. 
Oh you beat me Hack.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Dec 7th, 2009, 07:17 AM
#8
Thread Starter
Junior Member
Re: Display text file in frame
Many Many thanks ... only one thing more ... can u plzz tell me what is the meaning of LOF(1),1 in the parameter of input .... and can you plzz give me the code of print button ?? Thanks again .
-
Dec 7th, 2009, 07:20 AM
#9
Re: Display text file in frame
-
Dec 7th, 2009, 07:23 AM
#10
Thread Starter
Junior Member
Re: Display text file in frame
Thank you very much ... can You give me the code of print button ?? I am very grateful to you for giving your valuable time to me . Thanks again.
-
Dec 7th, 2009, 09:26 AM
#11
Re: Display text file in frame
Here is a reusable print function
vb Code:
Private Function PrintTextFile(sTextFile As String) As String
If Dir(sTextFile) <> vbNullString Then
Open sTextFile For Binary As #1
PrintTextFile = Input(LOF(1), 1)
Close #1
End If
End Function
Private Sub Command1_Click()
Screen.MousePointer = vbHourglass
Printer.Print PrintTextFile("c:\rahulpqr.txt")
Printer.EndDoc
Screen.MousePointer = vbDefault
End Sub
-
Dec 7th, 2009, 10:22 AM
#12
Thread Starter
Junior Member
Re: [RESOLVED] Display text file in frame
Thanku Thanku Thanku .......... My problems are resolved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|