Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Read Random Lines From Text File


Hey does anyone know how when i calick a button on my form it will read a random line from a text file that i created and insert it in to a text box?

Thanks For Any Help.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Read Different Lines Of A Text File?
I'm sure this is an easy enough question to answer but I wasn't able to find any threads about it so my apolgies if it has already been answered.

Basically what I need to do is read different lines of a text file depending on a random number for example on a number of 4 it will read line 4 of the text file. I am aware how to read the first line of a text file with

Open ("C: est.txt") For Input As 1
Line Input #1, strTest
Text1.Text = strTest
Close #1

however I am unaware on how to read any other lines.

Any help is greatly apprecitated thanks in advance

Read First Ten Lines Of A Text File?
I have some code that currently reads the first line of a text file. I want to change this and have it read the first ten lines, is this possible?

Here is the current code (blatantly simple):

'Open File for Reading
Open workfile For Input As #1
'Read in first line of file
Line Input #1, strFilesText
Close #1

Thanks.

Read First Ten Lines Of Text File?
I have some code that currently reads the first line of a text file. I want to change this and have it read the first ten lines, is this possible?

Here is the current code (blatantly simple):

'Open File for Reading
Open workfile For Input As #1
'Read in first line of file
Line Input #1, strFilesText
Close #1

Thanks.

How To Read A Few Lines From A Text File
HI all - i'm realy stuck

I'm reading a .txt file into a textbox but i'm only interessted in a few lines.

eksample:

DCT4NCK by jozso v0.0a
----------------------
IMEI is '350774103958688'
ASIC Type is 2
Provider is '21601'
Box serial is '32820'

#pw+989202003754006+1#
#pw+253265375104161+2#
#pw+325166543323363+3#
#pw+404257220234456+4#
#pw+058323470625423+5#
#pw+429257443744651+6#



The Above shows whats in my text box.
Now i want to sort out my text so the only thing remaining is:

#pw+989202003754006+1#
#pw+253265375104161+2#
#pw+325166543323363+3#
#pw+404257220234456+4#
#pw+058323470625423+5#
#pw+429257443744651+6#

I tryed "all" But i cant figure out how to do it.

Basicly it would be fine just to read from line 8 -> 13 But how ?

Heres the code i'm using to read the textfile:

Dim FileLength
Open "code.txt" For Input As #1
FileLength = LOF(1)
var1 = Input(FileLength, #1)
calcedcodes.Text = var1
Close #1

I'm realy kind of new to VB so plz take it from the top

Thx in advance



Edited by - Dr.Bizar on 7/26/2003 7:03:33 AM

Read First 6 Lines Of A Text File
I am sure reading from a file question has been asked before. But I am trying to read the first six lines of a file. Can someone give me a small example or any links ?


A VB turned PHP geek

Text File With 10 Lines, Want To Read And Display Only Second Line ... How?
Newbie question: I have a textfile (mytext.txt) containing 10 lines total: I have successfully coded how to read and display the first line OR all lines from the text file ... Next Step: How/What would I code to read and print say, only the second line?

Here's what I have:

Quote:





Option Explicit

Dim sampleoutput As String


Private Sub Command1_Click()
'Reads and displays first line from text file.
Open "C:My DocumentsPOS405dbtxtsamplemytext.txt" For Input As #1
Input #1, sampleoutput
Picture1.Print ""
Picture1.Print sampleoutput
Close #1
End Sub


Private Sub Command2_Click()
'Runs a loop to read and display all lines from text file.
Open "C:My DocumentsPOS405dbtxtsamplemytext.txt" For Input As #1
Do While Not EOF(1)
Input #1, sampleoutput
Picture1.Print sampleoutput
Loop
Close #1
End Sub


Private Sub Command3_Click()
'This code needs modification to read and display second line from text file.
Open "C:My DocumentsPOS405dbtxtsamplemytext.txt" For Input As #1
Input #1, sampleoutput
Picture1.Print ""
Picture1.Print sampleoutput
Close #1
End Sub





Thank you for any help.
~ Juanita

Read A Random Line From A Text File
i need to open a random line of a text file and save it in a string varibale. how would i go about doing this?

thnx for any help
Matt

Read Random Line From Text-file
Hi!

I want to read a random line from a text file. My text file has 315 lines in it. Here is what I have written so far:


Code:
Dim number As Integer
Dim line As Integer

number = Int(300 * Rnd) + 1
Open App.Path & "words.txt" For Input As #1
For line = 1 To number
Input #1, line
Next
MsgBox (line)
Close #1

But every time I try to run this, the debugger informs me about Run-time error '62': Input past end of file.

The problem can't be with the randomizer because I checked the output once and it said that the number was 8. And since my text-file is 315 lines long, I really can't figure what is the problem.

Can anyone help me?

Function To Read A Random Line From A Text File
has anyone got a function i can use for returning a random line from a text file? i have a quotes file and i want to make it print any line from the file which has over 2000 quotes!!

Read A Random Line From A Text File Separated By A %
How can i load a random line from a text file wich is separated by a %?
for example i have this text:

%
And 1.1.81 is officially BugFree(tm), so if you receive any bug-reports
on it, you know they are just evil lies."
(By Linus Torvalds, Linus.Torvalds@cs.helsinki.fi)
%
"...and scantily clad females, of course. Who cares if it's below zero
outside"
(By Linus Torvalds)
%

So the program will read a random line wich is between the %

Thanks in advance

Please,help Me~ I Need To Read Input Text File With Space-separated Datas In Lines
Hi, good day to all of you~

I'm a newbie in VB programming. Now I have to work out a project with this VB programming.

My question is that, how can I read an input text file with space-separated datas in every single lines in the .txt file?

eg. of input file:-
Bus Car Boat 1.0 2.0 3.0
1.2 1.3 2.2
521 544 566

As you can notice that there are no fixed of fields in the input file for each line. For example, there are 6 values in line #1, but 3 values for line #2 and line #3.

And one more thing is that the number of "space" between those values are not the same. There are 3 "spaces" between each values in the line #2.

I cannot change the input file by having only one "space" separated because the input file is in standard format.

Please... I really have no idea how to do this.

the following is my code:

VB Code:
Dim file_path As StringDim file_name As StringDim vin As String Private Sub Command1_Click()Dim hFile As IntegerDim strContents() As StringDim lngElement As Long ' Retrieve the contents of the file.Dim a, b, chFile = FreeFileOpen File1.Path + "" + File1 For Input As #hFileDo While Not EOF(hFile)ReDim Preserve strContents(0 To lngElement)Line Input #hFile, strContents(lngElement)lngElement = lngElement + 1LoopClose #hFile' Write the 1st line from the contents to Text1a = Split(strContents(0)) Me.Text1.Text = a(0)Me.Text2.Text = a(1)Me.Text3.Text = a(2)Me.Text4.Text = a(3)Me.Text5.Text = a(4)Me.Text6.Text = a(5) b = Split(strContents(1)) Me.Text7.Text = b(0)Me.Text8.Text = b(1)Me.Text9.Text = b(2) c = Split(strContents(2)) Me.Text10.Text = c(0)Me.Text11.Text = c(1)Me.Text12.Text = c(2)  End Sub  Private Sub Dir1_Change()    File1.Path = Dir1.PathEnd Sub Private Sub Drive1_Change()    Dir1.Path = Drive1.DriveEnd Sub Private Sub File1_Click()    File1.Path = Dir1.PathEnd Sub


The output when i read the input file:



p/s: do i have to make my code so complicated? any other way to simply it? Thanks~

Hmm - New Lines Arent Read As New Lines By Vb In A File
Heres the situation
im using urldownloadtofile to download a text file from the internet onto the harddrive. although the textfile on the net has 5 items, each on a single line, when i use that function the file saves as 5 items all on a single line.. and where a new line is supposed to be, i see a "box" in notepad..

needless to say, when i try to load the file into an array using Line Input, all 5 items are on a single array number, instead of one item in each array number..

heres what i mean..

text file online:
a
b
c
d
e

text file when downloaded to hd:
a[]b[]c[]d[]e

the box is interesting, if i copy the entire text from the file on my hd and paste it, they paste with all 5 items on seperate lines..

my question is, how can i load a[]b[]c[]d[]e with one item in each array with VB? line input wont work cause itll store a[]b[]c[]d[]e in one string

Read Lines And Count Lines From Txt File - Thank Ye All
hello again

im back for some more help, so i hope you guys can.

ive had a quick search on the forums for this but cant find anything that helps, so heres my problem:

i have this code:
Code:
Function random2()
Dim lines As Integer
Dim current As String
lines = 0
    Open "C:files.txt" For Append As #1
    Do While Not EOF(1)
        Line Input #1, current
            lines = lines + 1
            MsgBox (current)
    Loop
    Close #1
txtFILE = lines
End Function


but that code doesnt work, it does count the lines at all, i get no msgbox's, no count, no nothing.

any help would be much appreciated.

thanks.


Primary_Slave



----------------------------------------------------------------------------------------
I'm all wrapped up in my binary blanket and I'm coding on late into the night
----------------------------------------------------------------------------------------

Edited by - Primary_Slave on 11/4/2004 9:46:42 AM

Random Lines In .txt File
I'm making a kind of quiz/test thingy, with ten random questions and then you get a score at the end. if i'm selecting random lines (questions) from a .txt file, is there a way to make sure i don't get the same one twice during a set of 10 questions?

thnks

Getting Two Random Lines From A File?
Hi,

How do I grab two random lines from a file?

Say my file says:

David
Tony
Matthew
Richard
Herbet

How do I randomly pick two of those names?

I havent a clue how to go about it. I was thinking of ways to do it and the best I could could come up with is writing each line to an array, then select 2 random numbers that arent the same and usethat to select the array 'box' (what is the proper term for that :|)

Anyone got any other ways, 'cos mine seems a little unecessary..

Lines In Random Access File
how can i find the number of lines in a file opened for "random"

How To Read Different Lines In Text?
i want to read line 7 for example and input it's values.. how can i do that?

Read In LineS Of Text Into An Array
hey guys
i've looked at other posts but can only seem to get this to work for 1 line:

what i want to do.
i have a txt file with data as such
1
2
3
4
5
6
7
8
9
10


i need to read this into an array eg:

dim arrdata(1 to 10)

open **** for input as #1

lineinput #1, data

and from there i'm lost>.........

what is the code i need to:
read line 1, store to arrdata(1)
read line 2, store to arrdata(2)
read line 3, store to arrdata(3)
etc etc etc

is there a way i could do it with a loop
for i=1 to 10 step 1
read line i ???????? store to arrdata(i)
next i

any help appreciated [especially good help cheers

Read And Count Lines In A Text Box
Often, you may need to know how many lines of text there are in
a multi-line textbox. While Visual Basic makes it easy to determine
how many paragraphs the textbox contains, using code like so:

Private Sub Command1_Click()
Dim myParas As Variant
myParas = Split(Text1, vbNewLine)
MsgBox UBound(myParas) + 1
End Sub

This code, as you can see, only parses out hard carriage returns;
whereas you want to know how many lines of text the control contains.

To accomplish this task, you'll need to resort to the SendMessageAsLong()
API function. This function conforms to the following syntax:

Private Declare Function SendMessageAsLong Lib "user32" _
    Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, ByVal lParam As Long) As Long

To obtain the number of lines, you pass in the EM_GETLINECOUNT
constant in the wMsg parameter. Declare this constant like this:

Const EM_GETLINECOUNT = 186

Finally, to use the function, pass in the handle to the textbox
from which you want to retrieve the line count, as well as the
wMsg we mentioned earlier. Example code might look like so:

Private Sub Command2_Click()
Dim lCount As Long
lCount = SendMessageAsLong(Text1.hWnd, EM_GETLINECOUNT, 0, 0)
MsgBox lCount
End Sub

How To Read 1 Random Text Line?
How to read 1 random text line from *.txt file ?
I know how to read whole file, but i dont know how to read only 1 random line..!

For example:
I have .txt file with jokes, 1 joke per line..
I want when i press Button on my form, there shows 1 random joke from that file.

How?

Can I Read Specified Lines In A Txt File??
Hi, i am a very new newbie.
I have a log file like this format:

0
...........(data in the log file, only one line)
0
...........(data in the log file, only one line)
0
...........
...........(data in the log file, two lines)
0
.........
.........
0
..........
0


I want read the data lines enclosed by the "0"s one by one and return it into string.
Any good idea?



Thanks....
Sami

Read Txt File Lines!!!
HI!!
Can anyone please tell me how can i read a specific line in textfile??
like i have 3 lines in text file:
this s first line
second line!
and the third!

How can i read second line???

Thanx!!

How To Read Certain Lines In A File And Tell What Is Different
Hello,
I have 2 files that I am going to compare. I was wondering how would I go about to read those files, and tell what is different. Take for instance...that file1.txt has <name>Fred</Fred>
<name>Barney</name>
<name>This</name>
File2.txt has...
<name> Barn</name>
<name> Fred</name>
<name> This</name>

Then I would have file box say file2.txt is different than file1.txt.
Because it has more names than than file1.txt and also file2.txt is missing barney.

Can someone tell me of a website that can help me with this, or can they help me themselves?

Read Certain Lines From Txt File
I am reading a txt file for a puzzle game. I use the first line for the Category. The rest of the lines are the answers. I can read line 1 fine to get the Category. I can also read All the Lines for the answers. I need to know how to only read from Line 2 to the EOF for the answers.

Thanks in advance,
Phil

Read From File And Store Lines
Hi there,
This is the code I have so far:
I wish to open this text file and then store each line of the text file in a different variable. Each line consists of a file path.

This is my code so far

It would be really good if anyone could help. Thanks.


Code:
Public Sub actuallybindnow()
Dim thefilenames As String
Open App.Path & "indhelp.txt" For Input As #66
While Not EOF(66)
Input #66, thefilenames
Wend
Close #66
End Sub

Random Read From .dat File
Hi, am having trouble with getting a random record read from a file.

The way it is now, it only always reads the first record.(theres only 2 records, once I get it working correctly I will add many more images). How do I write this so it loads a random record from a file?


EDIT: After reading abit more I learned about the get command, but not sure how it works. The dat file I am accessing has 2 variables I need to pass to the program and that is where I am stuck.

Here's what I have now.


VB Code:
'in seperate moduleOption Explicit Public Type inpnum    ans As String * 20 ' answer String    pict As String * 20 ' file locationEnd Type




VB Code:
' clears text box, loads random picture and sets ans$ variablePrivate Sub cmdNewWord_Click()        txtans.Text = ""         Dim inpnum As Integer    Randomize    inpnum = Int(Rnd * 2) + 1            Open (App.Path) & "dataanswers.dat" For Random As #1 Len = 40    Get #1, [color=Red]inpnum, ans$, pict$[/color]         Close #1         pictureHolder.Picture = LoadPicture(App.Path & pict$)    End Sub


inpnum = which record 1 or 2
ans$/pict$ = the 2 variables in each entry of the file

The part in red is what I am having a problem with, those are the 2 variables I need passed to the program. How do I use the "get" command to pass 2 variables?

Thanks for any replies.

How To Locate And Read A Txt File Containing Multiple Lines
hi , i am building a project that contains names of different people .. i have written it in a txt format line by line for example
Code:
david
harry
john
tom
catherine

the number of lines is variable this is my code to read it

Code:
Private Sub Command1_Click()
Dim nFileNum As Integer, sText As String, sNextLine As String, lLineCount As Long

nFileNum = FreeFile
Open "C:UserspannamDesktopNew Text Document.txt" For Input As nFileNum
lLineCount = 1

Do While Not EOF(nFileNum)
Line Input #nFileNum, sNextLine

sNextLine = sNextLine & vbCrLf
sText = sText & sNextLine

Loop
Text1.Text = sText


Close nFileNum

End Sub

but from this code i have to determine the location of the text file in the code itself. what would the code be if the user has to locate it manually ? plus all the text opens up in a single line ..how do i work around it ?
thanking you in advance

Random Access File (Read)
Hi,
I managed to write customer's details from the form to the file and it seems each customer has a specific number but when I want to read from the file it just read the LAST record.
For example if I entered 4 customers when I enter 1 I will get last record in the form it will happen for 2,3,4 as well.
Anyone can help me with that please.
thanks

Read And Writing For A Random Access File.
Im trying to setup a form that'll allow me to place details to a txt file but everytime i try it comes up with the debug menu, with something to do with the index number.
I dont have help on VB so i thought you guys could help me out.


Code:
Private Sub cmdAdd_Click()
Dim index As Integer
Dim filenumber As Integer
Dim filename As String
Dim garage As String

lblLorryField.Caption = Date
lblLorryID.Caption = LorryID

LorryID = LorryID + 1
'Look for the Lorry.txt relative to my project files
'Use the freefile function to reurn a number
filenumber = FreeFile
filename = App.Path & "Lorry.txt"

Open filename For Random As #filenumber

If InGarage = True Then
txtInGarage = yes
Else
txtInGarage = no

index = 0
Do While (Not EOF(filenumber)) And (index < max)
index = index + 1
With Lorry(index)
Input #filenumber, Lorry(index).RegistrationNo, Lorry(index).MakeModel, Lorry(index).MaximumWeight, Lorry(index).InGarage
End With
Loop
Close #filenumber
LorryCount = index

If LorryCount < max Then
cmdAddLorry.Enabled = True
End If
End If
End Sub

Private Sub cmdQuit_Click()
Unload Me 'Exit window
LorryCount = LorryID
End Sub

Private Sub Form_Load()
lblLorryField.Caption = " "
lblLorryField.Caption = Date
End Sub

Private Sub tmrLorryDetails_Timer()
lblLorryField.Caption = Date
End Sub

Cheers if anyone can.

Need Help On Read/Write Random Access File
Hello there, I need your help badly!
I have a "Name.txt" file as below with 6 lines

1, "lastname", "firtname"
2, "lastname", "firtname"
3, "lastname", "firtname"
4, "lastname", "firtname"
5, "lastname", "firtname"
6, "lastname", "firtname"

I have a ListBox (lstCustomer) and ReadFile Button on the form.

----- In General Option Declaraion ------
Private Type Customer
intAccountNumber As Integer
strLastName As String * 10
strFirstName As String * 10
End Type
---------------------------------------

Private Sub cmdReadFile_Click() 'ReadFile button
Dim udtCustomer As Customer
Dim strFileName As String
Dim index As Integer
Dim intRecordNumber As Integer
Dim intFileNumber As Integer

strFileName = "C:Name.txt"
intFileNumber = FreeFile

Open strFileName For Random As #intFileNumber Len = Len(udtCustomer)
intRecordNumber = LOF(intFileNumber) / Len(udtCustomer)
For index = 1 To intRecordNumber
Get #intFileNumber, index, udtCustomer
lstCustomer.AddItem udtCustomer.intAccountNumber & " " & _
udtCustomer.strFirstName & " " & udtCustomer.strLastName
Next index
Close #intFileNumber

End Sub


after I click the ReadFile button, it displays funny chararacters in the listbox..can anyone help me on this? maybe the COMMA (,) in the Name.txt? o what?

thankx!

READ/WRITE From Random Access File NEED HELP
im taking a VB .NET class and im required to produce something similar to "the mechanics journal" at www.thehomejournal.com . anyways im not exactly sure how to code the program to when someone clicks an item in the list box , it displays that information stored in various and multiple controls. I think i need to read/write from a random access file, but im not too sure on how to code pieces in the middle. i hope this is clear. i need some help thanx!!


screen shot of program:

Common Dialog Box To Read Random File
Hey Im stuck. I have to write a program that will read in files using a common dialog box, However I am getting a mismatch error. I have included the code of what I have so Far and what I have in the project. Maybe I am entering the data wrong into the folder i am reading

Jones ,Jason ,7166275519,T
Pope ,Jose ,7165854519,T

This is how the data looks in the direcotry folder in the temp file

Here is the code and the program of what i have so far.

Private Type udtLookup
strLast As String * 20
strfirst As String * 10
strnumbers As String * 10
strDeletecode As String * 1 'F= False; T = True
End Type

Dim mudtLookup As udtLookup


Private Sub cmdexit_Click()
End
End Sub

Private Sub ReadFileIntoList()

dlgcommon.ShowOpen
Open dlgcommon.FileName For Random As #1 Len = Len(mudtLookup)
Do Until EOF(1)
Get #1, mudtLookup.strLast & mudtLookup.strfirst & mudtLookup.strnumbers, mudtLookup
lstdata.AddItem mudtLookup.strLast & "," & mudtLookup.strfirst & "," & mudtLookup.strnumbers
Close #1
Loop



End Sub


Private Sub Form_Load()

ReadFileIntoList

End Sub

Private Sub mnuExit_Click()
End
End Sub

Read Character From Random Access File
Hello,

I have a text file which contains characters in one long line which were randomly generated. the file is about 45KB. I want to start reading characters from a certain point and end at a certain point.

For example.. i have a loop which which will allow me read all the character from 500 to 700 and store them in a string. then on the second loop read characters from 600 to 1500. I already have the startind and ending points in an array.

Thank you advance.

WebBrowser Fill Form - Too Many Lines - Read HTML From File?
Ok. I am trying to auto fill this form online using WebBrowser.Document statements.

Here is what I was trying becuase VB would not let me paste the whole chunk of text as a string. So I tried breaking it up and got another massage tellime too many lines continues.

VB Code:
WebBrowser2.Document.getElementById("text").Value = _& "<td colspan=4><p> <strong><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif">Asking _&        Price:</font></strong><em><strong><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif"> _&        </font></strong></em><strong><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif">$239,000</font></strong></p></td> _&    <td width=780 height=29 colspan=5> <p align="center"><strong><font face="Verdana, Arial, Helvetica, sans-serif">Beautifull _&        1,400 Sq Ft Home 45Min from Las Vegas!</font></strong></p></td> _&  </tr> _&  <tr> _&    <td width=780 height=267 colspan=3 valign="top"><img src="img/2381_small.jpg" width=204 height=267> _&    </td> _&    <td> <img src="img/m13.jpg" width=20 height=267></td> _&    <td colspan=5 valign="top"><p>&nbsp;</p> _&      <p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Two story _&        home on 1/2 acre. 2 Car garage. 5 Car carport. Circle drive. 3 Beddroom, _&        3 Full Baths. 1400 sq ft. Desert landscaping.<br> _&        Perfect Vegas Gettaway! Located in Pahrump 45min from the strip. </font></p> _&      <font face="Verdana, Arial, Helvetica, sans-serif"> _&      <p><font size="-1">MUST SELL!!! Relocating to Oregon. This home is a BARGIN _&        at only $239,000.00</font></p> _&      <p><font size="-1">Stop by and see for yourself: 2381 S. Mallard Ave, Pahrump _&        NV. 89048</font></p> _&      <p><font size="-1">Call Jason at 702-515-9892<br> _&        Or email: <a href="mailto:jason@infintium.org">jason@infintium.org</a></font></p> _&      <p>&nbsp;</p> _&      <p><font size="2">Website Links:</font></p>      <p><font size="2"><a href="http://www.adpost.com/us/homes_offices/17558">http://www.adpost.com/us/homes_offices/17558</a></font></p>      <p><font size="2"><a href="http://lasvegas.craigslist.org/rfs/172693874.html">http://lasvegas.craigslist.org/rfs/172693874.html</a></font></p>      <p><font size="2"><a href="http://lasvegas.craigslist.org/rfs/174368285.html">http://lasvegas.craigslist.org/rfs/174368285.html</a></font></p>      </font></td>  </tr>  <tr>    <td width=780 height=834 colspan=9><table width="100%" border="0" cellspacing="0" cellpadding="0">        <tr>          <td colspan="3">&nbsp;</td>        </tr>        <tr>          <td><div align="center"><a href="img/Picture-002_small.jpg"><img src="img/Picture-002_small.jpg" width="240" height="180" border="0"></a></div></td>          <td><div align="center"><a href="img/Picture-010_small.jpg"><img src="img/Picture-010_small.jpg" width="240" height="180" border="0"></a></div></td>          <td><div align="center"><a href="img/Picture-004_small.jpg"><img src="img/Picture-004_small.jpg" width="240" height="180" border="0"></a></div></td>        </tr>        <tr>          <td>&nbsp;</td>          <td>&nbsp;</td>          <td>&nbsp;</td>        </tr>        <tr>          <td><div align="center"><a href="img/Picture-002_inside_small.jpg"><img src="img/Picture-002_inside_small.jpg" width="240" height="180" border="0"></a></div></td>          <td><div align="center"><a href="img/Picture-003_inside_small.jpg"><img src="img/Picture-003_inside_small.jpg" width="240" height="180" border="0"></a></div></td>          <td><div align="center"><a href="img/Picture-006_inside_small.jpg"><img src="img/Picture-006_inside_small.jpg" width="240" height="180" border="0"></a></div></td>        </tr>        <tr>          <td>&nbsp;</td>          <td>&nbsp;</td>          <td>&nbsp;</td>        </tr>        <tr>          <td><div align="center"><a href="img/Picture-013_inside_small.jpg"><img src="img/Picture-013_inside_small.jpg" width="240" height="180" border="0"></a></div></td>          <td><div align="center"><a href="img/Picture-010_inside_small.jpg"><img src="img/Picture-010_inside_small.jpg" width="240" height="180" border="0"></a></div></td>          <td><div align="center"><a href="img/Picture-011_inside_small.jpg"><img src="img/Picture-011_inside_small.jpg" width="240" height="180" border="0"></a></div></td>        </tr>        <tr>          <td>&nbsp;</td>          <td>&nbsp;</td>          <td>&nbsp;</td>        </tr>        <tr>          <td height="180"><div align="center"><a href="img/Picture-012_inside_small.jpg"><img src="img/Picture-012_inside_small.jpg" width="240" height="180" border="0"></a></div></td>          <td><div align="center"><a href="img/Picture-008_inside_small.jpg"><img src="img/Picture-008_inside_small.jpg" width="240" height="180" border="0"></a></div></td>          <td><div align="center"><a href="img/Picture-009_inside_small.jpg"><img src="img/Picture-009_inside_small.jpg" width="240" height="180" border="0"></a></div></td>        </tr>        <tr>          <td height="19" colspan="3">&nbsp;</td>        </tr>        <tr>          <td height="19" colspan="3"><div align="center"><a href="http://extremetracking.com/open?login=infintiu"target="_top"><img src="http://t1.extreme-dm.com/i.gif"name="EXim" border="0" height="38" width="41"alt="eXTReMe Tracker"></img></a>              <script type="text/javascript" language="javascript1.2"><!--EXs=screen;EXw=EXs.width;navigator.appName!="Netscape"?EXb=EXs.colorDepth:EXb=EXs.pixelDepth;//--></script>              <script type="text/javascript"><!--var EXlogin='infintiu' // Loginvar EXvsrv='s10' // VServernavigator.javaEnabled()==1?EXjv="y":EXjv="n";EXd=document;EXw?"":EXw="na";EXb?"":EXb="na";EXd.write("<img src=http://e1.extreme-dm.com","/"+EXvsrv+".g?login="+EXlogin+"&amp;","jv="+EXjv+"&amp;j=y&amp;srw="+EXw+"&amp;srb="+EXb+"&amp;","l="+escape(EXd.referrer)+" height=1 width=1>");//--></script>              <noscript>              <img height="1" width="1" alt=""src="http://e1.extreme-dm.com/s10.g?login=infintiu&amp;j=n&amp;jv=n"/>              </noscript>              &nbsp;</div></td>        </tr>      </table> </td>



If there a way to have this data be pasted in from a text file? or better yet, read it from a .html file as that would be the best way.

:::: OR ::::

Is there a way to declare a VERY VERY long string? Very long like a whole html file?

Help me plese. Thanks.

Simple Random File Integer Saves/read
I want to save a (single diamension) array of type INTEGER to a random
(ie binary) file, and read it again into the array.
I am having trouble reading the data & the lenght of data
Is this correct?
Or is there a quicker/simplier way?
write:
open "blaa" for random as #1 len =2
for x= 0 to y
put #1,x+1,array(x)
next x
close 1
Read:
x=0
open "blaa" for random as #1 len =2
do while lof(1)
get #1,x+1,array(x)
x=x+1
loop
close 1

Random Access File Write/Read && Combo Boxes
Hello All,


I'm attempting to create a Program using a random access file. I need to some how take the random access file and put the part of each record into a combo box and with it, a reference to which record it belong to on the random access file.

Basically, what I want to do is have a program where there's a combo box and a bunch of text boxes. Whenever some one selects an entry in the combo box, I want the text boxes to show related information about the entry in the combo box. I'm just not too sure about how to do it.

Thanks!

Jason

Open A Text File And Count The Lines In Text File
Does anybody have any good vb code that would allow me to open a file count the lines in the file (or search for a certain character and do a count of that character) close the file and then compare it to a variable count. if the count is the same then continue, if the file is not the same delete the file and exit or abort the program.

example the lines I need to count start with 100000.

So i have a count of what is being pulled from the database of 60. I want to see if a file exists, if the file exists I want to do a count of all the lines starting with 100000. and compare it to 60 if the count is = 60 then finish, if it is not 60 then error out.

thanks!!!!

Insert Multiple Lines Of Text Into An Email From A Text File
Hi All,

I am looking for a way to read multiple lines from a text file anything upto 100 and then insert those into the body of an email message.

I can send the email as I know how to do that it just the reading of the text and then puttiong it into the email that I have a problem with.

Any idea's,

Regards,

Oz

Read From Text File Using VB And Insert Into SQL Table Until Eof Text File Reach
Dear All,

my text file like following,

a1, b1, c1, d1, e1
a2, b2, c2, d2, e2
a3, b3, c3, d3, e3
a4, b4, c4, d4, e4
.................

and im going to insert this values into SQL Tables with columns, [a, b, c, d,
e]

how im going to do so? i use below src code to do but i can not get the next
line and next line of text file until it finished insert

Private Sub mot_Click()
'Shell ("C:Program FilesMicrosoft OfficeOffice11MSACCESS.EXE c:fisherdb.
mdb /x ImportOpsNilai")

'frmPicCd.Show
Dim db_connect
' Path = App.Path & "ERP consumable code.xls"

Dim objFSO
Dim objFile, objTextStream
Dim strContent
Const ForReading = 1
Dim FileName, IEPath, strC1 As String
FileName = "U:ureportuopsRepNilai.txt"

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.GetFile(FileName)

Set objTextStream = objFile.OpenAsTextStream(ForReading,
TristateUseDefault)

If objFSO.FileExists(FileName) Then

Set objFile = objFSO.OpenTextFile(FileName, ForReading)

'While Not objFile.EOF
strC1 = objFile.ReadLine
Dim word
ReDim word(2)
word = Split(strC1, ",")
' Dim t1, t2, t3 As String
' MsgBox RTrim(LTrim(word(44)))
' t1 = Replace(word(0), """", "")
' t2 = Replace(word(1), """", "")
Dim sql
Dim rs As New ADODB.Recordset
sqldb.Execute ("delete from OPS_Nilai")
rs.Open ("Select * from OPS_Nilai"), sqldb, adOpenDynamic,
adLockOptimistic
With rs
.AddNew
!Field1 = RTrim(LTrim(word(0)))
!Field2 = RTrim(LTrim(word(1)))
!Field3 = RTrim(LTrim(word(2)))
!Field4 = RTrim(LTrim(word(3)))
!Field5 = RTrim(LTrim(word(4)))
!Field6 = RTrim(LTrim(word(5)))
!Field7 = RTrim(LTrim(word(6)))
!Field8 = RTrim(LTrim(word(7)))
!Field9 = RTrim(LTrim(word(8)))
!Field10 = RTrim(LTrim(word(9)))
!Field11 = RTrim(LTrim(word(10)))
!Field12 = RTrim(LTrim(word(11)))
!Field13 = RTrim(LTrim(word(12)))
!Field14 = RTrim(LTrim(word(13)))
!Field15 = RTrim(LTrim(word(14)))
!Field16 = RTrim(LTrim(word(15)))
!Field17 = RTrim(LTrim(word(16)))
!Field18 = RTrim(LTrim(word(17)))
!Field19 = RTrim(LTrim(word(18)))
!Field20 = RTrim(LTrim(word(19)))

!Field21 = RTrim(LTrim(word(20)))
!Field22 = RTrim(LTrim(word(21)))
!Field23 = RTrim(LTrim(word(22)))
!Field24 = RTrim(LTrim(word(23)))
!Field25 = RTrim(LTrim(word(24)))
!Field26 = RTrim(LTrim(word(25)))
!Field27 = RTrim(LTrim(word(26)))
!Field28 = RTrim(LTrim(word(27)))
!Field29 = RTrim(LTrim(word(28)))
!Field30 = RTrim(LTrim(word(29)))
!Field31 = RTrim(LTrim(word(30)))
!Field32 = RTrim(LTrim(word(31)))
!Field33 = RTrim(LTrim(word(32)))
!Field34 = RTrim(LTrim(word(33)))
!Field35 = RTrim(LTrim(word(34)))
!Field36 = RTrim(LTrim(word(35)))
!Field37 = RTrim(LTrim(word(36)))
!Field38 = RTrim(LTrim(word(37)))
!Field39 = RTrim(LTrim(word(38)))
!Field40 = RTrim(LTrim(word(39)))

!Field41 = RTrim(LTrim(word(40)))
!Field42 = RTrim(LTrim(word(41)))
!Field43 = RTrim(LTrim(word(42)))
!Field44 = RTrim(LTrim(word(43)))
!Field45 = RTrim(LTrim(word(44)))
.Update

End With
'objFile.SkipLine
'objFile.MoveNext
' Loop
End If

objTextStream.Close
MsgBox "Update completed!!!", vbOKOnly + vbInformation, "Fisher Nilai"
End Sub

kindly advice


thank you

--
Message posted via VBMonster.com
http://www.vbmonster.com/Uwe/Forums...vbasic/200707/1

Read And Append Text File Details To Onother Text File
i have three text files and i want to read staff from the other two and append it to one .how do i do it??

when opportunities arises ,only the prepared mind is fovoured

Lines In Text File
I'm not sure if I should be posting this here but I figured someone here would know this.

Are the # of lines in a text file limited by memory space or a numeric value.

Thanks

Lines In A Text File
Im making a program for learning [Pronomen] for german words:

Der Baum
etc....

I want to display a label that says how many questions (lines) there are in the file #1 and then how can I add a limit to how many lines it can read in?

Can u give me some help please?

How Do I Add Lines To A Text File?
Hi guyz.

I wanted to add lines to a text file but what i do results to replacing the all the lines in the file. Plese help! Thanx!

Lines From A Text File
I need help with VB, I know almost nothing and I am trying to write a very simple program.
Heres the problem, I need to know how to get line 46 from a text file called "dat.txt". Thats my whole program... Please help me....

Lines In Text File
Can I just know some how the no of lines in a text file? It's aim is to set the max value for a progress bar while importing.Thanks in Advance

Lines In Text File
is there any simple way to get the number of lines in a text file?
i know i can loop until eof(1) = true but is the any other way?

Get # Of Lines In Text File
I create a text file using the File System Object and add lines to it by using this example:

txtkill.Write ("john sucks") ' Write a line.
txtkill.WriteBlankLines (1)
txtkill.Write ("real bad") ' Write a line.
txtkill.Close

I need to add to this file some lines from another text file, is there any easy way to count the number of lines in the text file?

# Of Lines In A Text File
How do I get the number of lines in a text file?

Copyright © 2005-08 www.BigResource.com, All rights reserved