| | |
Visual Basic Problem??
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2008
Posts: 30
Reputation:
Solved Threads: 0
I have written a program that reads a text file and then saves it as an image file.Although the program is reading the file but its having errors saving it as an image file. Please Help!
Option Explicit
Private Const SRCCOPY = &HCC0020
Private Const MERGEPAINT = &HBB0226
Private Const SRCAND = &H8800C6
Private Const DIB_RGB_COLORS = 0
Private Const DIB_PAL_COLORS = 1
Private Declare Function BitBlt Lib "gdi32" _
(ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Dim nRet As Long
Private Sub Command1_Click()
'Outline:- Asks the user for a file.
'- Reads all the data into Text1.
Dim FilePath As String
Dim Data As String
FilePath = InputBox("Enter the path for a text file", "The Two R's", _
"D:\address.txt")
'Asks the user for some input via an inp
' ut box.
Open FilePath For Input As #1
'Opens the file given by the user.
Do Until EOF(1)
'Does this loop until ' f>End Of File(' >EOF) for file number 1.
Line Input #1, Data
'Read one line and puts it into the vari
' ble Data.
Text1.Text = Text1.Text & vbCrLf & Data
'Adds the read line into Text1.
MsgBox EOF(1)
Loop
Close #1
'Closes this file.
End Sub
Private Sub Command2_Click()
pic.Visible = True
pic.Height = Text1.Height
pic.Width = Text1.Width
nRet = BitBlt(pic.hDC, 0, 0, Text1.Width - 2, Text1.Height - 2, Me.hDC, Text1.Left + 1, Text1.Top + 1, SRCCOPY)
pic.Picture = pic.Image
SavePicture pic.Image, "text.bmp"
pic.Visible = False
Text1.SetFocus
End Sub Ok, I give an example.
In a form
> Draw a Picture box (Picture1)
> Draw a Command Button (Command1)
In a form
> Draw a Picture box (Picture1)
> Draw a Command Button (Command1)
VB Syntax (Toggle Plain Text)
Private Sub Command1_Click() Picture1.AutoRedraw = True Picture1.Print "Welcome" Picture1.Print "To" Picture1.Print "VB6" SavePicture Picture1.Image,"C:\Test.jpg" End Sub
Selva •
•
Join Date: Aug 2008
Posts: 30
Reputation:
Solved Threads: 0
•
•
•
•
Ok, I give an example.
In a form
> Draw a Picture box (Picture1)
> Draw a Command Button (Command1)
VB Syntax (Toggle Plain Text)
Private Sub Command1_Click() Picture1.AutoRedraw = True Picture1.Print "Welcome" Picture1.Print "To" Picture1.Print "VB6" SavePicture Picture1.Image,"C:\Test.jpg" End Sub
I want to put a lot of text in the textbox which is supposed to be captured. But the textbox does not resize to the text, Although it can show scrollbars. I want it to grow as big to fit the whole text on the screen no matter how big the text is.
Is there any way it can resize itself automatically to fit the whole text?
•
•
Join Date: Aug 2008
Posts: 30
Reputation:
Solved Threads: 0
Last edited by ChroNoS; Sep 17th, 2008 at 7:43 am.
![]() |
Similar Threads
- What value type is Global in Visual Basic? (Visual Basic 4 / 5 / 6)
- date format problem with access and visual basic (Windows NT / 2000 / XP)
- VBscript in a Visual Basic Application (Visual Basic 4 / 5 / 6)
- Problem in Serial Communication In Visual Basic (Visual Basic 4 / 5 / 6)
- Creating an OS in visual basic 6.0 (Visual Basic 4 / 5 / 6)
- How do I execute executable programs in visual basic using.... (Visual Basic 4 / 5 / 6)
- Visual Basic and C++ and Debug and DLLs (Visual Basic 4 / 5 / 6)
- Visual basic why does my exe file need dotnetfx? (VB.NET)
- passing arrays in visual basic (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Printing Memo Fields ACCESS 2000 vb6.0
- Next Thread: incremented unique id
Views: 1841 | Replies: 12
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
6 429 2007 access activex add age append application basic beginner birth c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





