What's Here?
- Members: 99,787
- Replies: 389,615
- Topics: 58,613
- Snippets: 2,047
- Tutorials: 550
- Total Online: 1,577
- Members: 50
- Guests: 1,527
Who's Online?
|
Welcome to Dream.In.Code |
|
|
Getting VB Help is Easy!
Join 99,787 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,577 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!
|
Reads and puts value in a textbox in its original text format.
|
Submitted By: Xenon
|
|
Rating:

|
|
Views: 38,667 |
Language: Visual Basic
|
|
Last Modified: January 4, 2006 |
|
Instructions: add a textbox to the form and a command button, the names are default VB6 chosen names |
Snippet
'(general declaration)
Dim nFileNum As Integer, sText As String, sNextLine As String, lLineCount As Long
'==================================
Private Sub Command1_Click()
' Get a free file number
nFileNum = FreeFile
' Open a text file for input. inputbox returns the path to read the file
Open "C:\Documents and Settings\Sudeep\My Documents\3.txt" For Input As nFileNum
lLineCount = 1
' Read the contents of the file
Do While Not EOF(nFileNum)
Line Input #nFileNum, sNextLine
'do something with it
'add line numbers to it, in this case!
sNextLine = sNextLine & vbCrLf
sText = sText & sNextLine
Loop
Text1.Text = sText
' Close the file
Close nFileNum
End Sub
Copy & Paste
|
|
|
Reference Sheets
Bye Bye Ads
Free DIC T-Shirt
Related Sites
Monthly Drawing
Partners
Top Contributors
Top 10 Kudos This Month
|