Storing Data From A Text File In Arrays, I Need Help!
I have to take the text file bellow and break it into an array, "Name","ID","Score" "Daisy","5","98" "Pluto","2","65" "Kermit","1","78" "Duke","3","87" "Cooter","6","93" "BossHog","8","74" "RoscoePcoltrane","7","94" "UncleJessie","9","86" "LukeDuke","10","89" "BoDuke","4","71" "Festus","12","99" "MissKitty","11","94"
I declared my the main array as udtList and the arrays as strName, intID and intScore
I have been tring to use bolth:
Input #1 udtList(i).strname, udtList(i).intID, udtList(i).intScore and Get #1 "", "", ""
Nothing I try seems to work and im about to take a crowbar to my computer, if you could offer any assistance I would be forever gratefull.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
HELP !!! - Storing Data To A Text File
Hi,
I need to get help. I have managed to send data from a vbform in to a text file which is on my local hard disk and the code is as follows:
Open "C:ClassTest ".txt" for Ourput as #fNos
and its working fine with just one form. BUT I have 3 other forms which all have a value that I need to send them to the same text file. Also I want them to be in the same row as form1 is sending the values, that is concatinating all values separated by a comma.
Pls give me some help cos I'm lost and I have been going round in circles.
Thanks
Storing Data In Text File
Hi, I am a very very beginner
I need to store the input details (book details) from the form fields into the text file and then retrieve how many books are stored.
I made a form with the tabs and I know how to create a text file in location but then I am stuck
I have the following 4 text fields
Dim ID As Integer
Dim Name As String
Dim Author As String
Dim Price As Integer
help!!!
Storing Text And Picture Data In The Same File.
Hey,
I'm trying to figure out how I could create a single file that would be able to contain both picture and text dat (as much as I needed), almost something along the lines of:
Open "C: est.bin" For Binary As #1
Put #1, Text1.Text, Picture1.Picture
Close #1
but obviously that doesn't work. Is it necessary to use databases to accomplish this? Is there a good tutorial I can find on it?
Thanks!
Storing Plain Text Data In Its Own File
Hi all i am just starting to get back into VB and i need a little help.
I am writing a program that asks a user to type in a set of numbers/letters
(in this case shipping containers).
Once the data is entered i have my 4 letters and i want to be able to call
up data relating to the 4 letters.
Basically i want it to show who the container belongs to and any other data
i wish to put in there relating to the container.
Rather than hard code everything i want it in a seperate file(s).
Thanks
Steve
Storing Data Form Text File Into Database
Hi...
I am doing project in visual basic for character recognition.
I have a problem for reading data from text file character by character and convert it into excel file and storing into various tables in database.Can anyone help me. Thanks..... in advance. Plz reply.
Storing And Editing Data Using Arrays
Hi everyone, i have been givin a task that I really need help with...
"A new research group is to be established. This group will monitor the local housing market and generate periodic reports on the status of this market. You are required to develop an application that will allow members of this research group to build up a profile of the local housing market. This software will allow a user to enter information on a property and review it as desired.
Requirements
1.The user should initially be given a list of options. Here they can choose to:
a) Enter new information, or
b) Review existing information.
2.Entering New Information
The user must be able to enter the following information about a property,
oArea
oAddress
oPrice in 1996
oPrice in 1998
oPrice in 2000
oPrice in 2002
oBrief description
oPicture (location of the picture on disk drive)
The system should be capable of storing information on 30 properties.
3.Review existing information
The user must be able to view the list of properties currently stored in the system.
The user must be able search for and retrieve information based on location of the property.
Information retrieved must be presented in an attractive manner and must include the data presented above, picture of the property and a pictorial representation of the house price over the four intervals (line graph). Note. This graph should be adequately labelled.
Any information entered by the user must be validated (i.e. if the system asks for a price to be entered, it must check that the user doesn’t enter a string).
In the development of your solution you must make use of the following programming concepts.
Arrays
Records
Procedures
Forms
Graphics
Deliverables Required:
Visual basic solution on floppy disk
The disk must include all source files for your entire project.
A running version of your application. Note. Please ensure that your solution runs from the a: drive before submission. Any program that does not run because it requires additional files on another drive will be considered incomplete.
You must include some sample house pictures on your disk.
Nothing else should be on this disk.
Clearly label the disk to include your student number and the name of your project.
Print-out of your screen forms
Print-outs of your code linked to your form & controls.
Print-outs of your property lists of your form and controls."
PLEASE HELP!!!!!!!!!!!!!!!
andy
Storing Data In A File
Hi everyone, I need to store values in a file and then be able to transfer those values to print off an invoice, e.g. product description, quantity, price etc.
I am using combo boxes to select relevant products which pulls up prices automatically. Can I then transfer this data into a Word doc or something similar?
Thanks
Help With Storing Data In A File
Hi again,
first thanks so much to those who helped me in the past, i just write code for a few hobby projects each year and its very generous for you all to be so helpful.
i am wanting to write data that i have retrieved and processed into a file that uses a format that i have no experience or understanding of. i DO have a code snippet provided by the programmer of the device that uses the file. which i posted in the C++ forum but got no responses. further the note i recieved says:
"We use C++ serialization to store data and pull it out of the user data files."
so does anyone know if its possible to store compatible data using VB6? any pointers to an example would be great.
thanks
jerry
Storing WAV Data In EXE File
Hello,
does anyone know how to store the WAV data a program needs into the compiled EXE file ?
Is there any control similar to the imagelist control (in which image data is stored and placed IN the EXE file, after compilation) for sound ??
Thanks
Storing Data In An Exe File
I need to store some data in an executable file and i need to know how.
Is there any???
Thanks for any help
Storing Data From A Html File
Hello,
Here's what I want to do... or at least what I've been trying for the last days...
I have several html files. They all have the same layout with some standard titles. Behind those titles there is some data that I need to get in a database. This data is different (from different length) in each html file.
example:
Let's say the standard title is "title:" and behind that we have 123456. So I need the 123456 in a string (or database).
Untill now I did it like this.
Open "C: est.html" For Input As #1
Do While EOF(1) <> True
Input #1, RawData
... and so on ...
Then I search for the word "title:" in the string RawData. When I found it, I open a loop and take every character in a string until I reach the character "<" beacuse then I know that the html code is starting again and my title is in the string.
Well, this is my explanation... but I can't figure it out how to let it work... Can somebody help me?
Thnx in advance!
Greetz!
Storing Data To The Program File Itself !!!
hi,
i know other methods for storing information. like storing to the registry or to a txt file or to a database..
but i think storing an encrypted information in the program file itself will be safer..
i need it to store a flag value to check if the user have a registered version or not, but how can i store data to the program .exe file itself???
any code?
thank u..
Storing/Restoring Data From A File
Hi, i'm a little stuck with a small project.
I am trying to create a multi-function tool for an online game. The problem is, I would like to be able to store IP addresses (which are typed into a total of 5 boxes incl. Port) into a file, which can later be restored.
As the file would contain a list of IP's the file would need to be loaded into a listbox or a combo box to select which IP address to restore.
Thanks in advance for any help and please remember I am very new to VB so be gentle :P
If there is something you feel I missed out or need more details, just ask and I will try my best to tell you.
btw, im using VB6.
Storing Parameters In Text File
I'm using the printer object to print certain information from my database to a form. The problem is that the users change printers therefore where on the page the information prints changes a little.
I want to build a print setup screen and have it default to whatever the user picked the last time they were in the
screen
printer.print
rs.open "Select * from table1"
do while rs.eof = false
x = textbox1.text
y = textbox2.text
Printer.ScaleMode = vbTwips
Printer.FontSize = 12
Printer.CurrentX = 1440 * x
Printer.CurrentY = 1440 * y
Printer.Print rs!field1
When the user closes the screen is it possible to store x and y into a text file and when the user opens the screen is it possible to read x and y from the text file
Text File For Storing Stats
Hello All,
I'm developing a new application which is going to be used to store statistics based on the button which is pushed. Essentially, the program is going to have 5 buttons (A-E) and there will also be a text box at the bottom for entering a number (default is 1).
When the user presses a button, I'd like the program to store the number into a text document.
There will be one file for each day and in the file, it will say something like this (by default):
[A] = 0
[b] = 0
[C] = 0
[D] = 0
[E] = 0
If the user presses the A button, then I'd like my program to open the txt file, and add the number in TextBox to the value in the text file. If C is pressed, it'll add that number to the C value in the text document. (Following me?)
Can anyone help me with some syntax on how this would be done, while preserving the text box structure? (No extra line breaks, anything like that) I guess I need help building code to search the textbox, pull out the value from the correct line (A-E depending on the button), then adding that value to a (integer) which is the value from the text box in the program, and then store that value back onto the correct line in the text file.
I think this may sound harder than it actually is going to be... but I'm still a very much newbie when it comes to reading and writing to text files.
Thanks in advance!
Storing And Retriving Data In Binary File
Hai,
i want to store and retrive data in binary format i am having a nested structure like this
Structure struct1
Dim a As Integer
Dim b As Boolean
Dim c As Boolean
Dim d As Integer
Dim e As Integer
Dim obj() As struct2
End Structure
Structure struct2
Dim a1 As Integer
Dim b1 As Boolean
Dim c1 As Boolean
End Structure
the size of the obj for struct2 will depend upon the value e in struct1.
the size of struct1 at the maximum will be 10.
I need help on this.
Thanks
Antony
I Have A Problem With Storing A Date Into A Text File
Hi there,
My problem is I am saving a Start date and an End date to a .txt file. The end date stores in the file correctly in the format #2004-02-09# whereas the start date is stored as "09/02/2004". I can't see where I'm going wrong. I've checked the data format on the form and they are both set to date.
I have another form which is to show the start date , the end date , and today's date and that form is the same with just the end date being shown correctly. the others are shown on the form as 09:02:2004
Can anyone help with where the problem lies.
Below is my code:
Private Type Personal
strName As String
strAddress As String
strCity As String
strCounty As String
strPostcode As String
strTelephone As String
dteDOB As Date
dteHirestart As Date
dteHireend As Date
intDays As Integer
End Type
Dim recPers As Personal
Option Explicit
'Define Variables
Dim strName, strAddress, strCity, strCounty, strPostcode, strTelephone, strVehdetails As String
Dim dteDOB, dteHirestart, dteHireend As Date
Dim intTotalcost As Integer
Dim intDays As Integer
Dim intSeats, intCost As Integer
Dim intCount1, intCount2, intCounter, intLoop, intVehicles, intEntries As Integer
Dim intIndex As Integer
'Show available vehicles in combo box
Private Sub cboAvail_Click()
intIndex = Me.cboAvail.ListIndex + 1
intDays = txtDays.Text
txtTotalcost = "£" & intDays * recVehicles(intIndex).intCost
txtNodays = txtDays
'Display vehicle details when selected from combo box
txtVehdetails = recVehicles(intIndex).strVeh & " , " & recVehicles(intIndex).strReg & " , " & _
"No. of seats = " & recVehicles(intIndex).intSeats
End Sub
'Clear contents of all text boxes
Private Sub cmdClear_Click()
txtName.Text = ""
txtAddress.Text = ""
txtCity.Text = ""
txtCounty.Text = ""
txtPostcode.Text = ""
txtTelephone.Text = ""
txtDOB.Text = ""
txtAge.Text = ""
txtHirestart.Text = ""
txtDays.Text = ""
txtHireend.Text = ""
txtTotalcost.Text = ""
txtNodays.Text = ""
txtVehdetails.Text = ""
End Sub
'save whatever is in text boxes to these variables
Private Sub cmdConfirm_Click()
strName = txtName.Text
strAddress = txtAddress.Text
strCity = txtCity.Text
strCounty = txtCounty.Text
strPostcode = txtPostcode.Text
strTelephone = txtTelephone.Text
dteHirestart = txtHirestart.Text
dteHireend = txtHireend.Text
intTotalcost = txtTotalcost.Text
strVehdetails = txtVehdetails.Text
Open "A:AssignmentBooked.txt" For Append As #2
Write #2, strName, strAddress, strCity, strCounty, strPostcode, strTelephone, dteHirestart, _
dteHireend, recVehicles(intIndex).intCost, intTotalcost, recVehicles(intIndex).strVeh, recVehicles(intIndex).strID, _
recVehicles(intIndex).strReg
Close #2
End Sub
Private Sub Form_Load()
'load in vehicle list
intCount1 = 1
Open "A:AssignmentVehiclelist.txt" For Input As #1
Do While Not EOF(1)
Input #1, recVehicles(intCount1).strVeh, recVehicles(intCount1).strID, _
recVehicles(intCount1).strReg, recVehicles(intCount1).strLic, _
recVehicles(intCount1).intSeats, recVehicles(intCount1).intCost
intCount1 = intCount1 + 1
Loop
intVehicles = intCount1
Close #1
On Error GoTo ErrorHandler
'load in booked list
intCount2 = 1
Open "A:AssignmentBooked.txt" For Input As #2
Do While Not EOF(2)
Input #2, recBook(intCount2).strName, recBook(intCount2).strAddress, recBook(intCount2).strCity, _
recBook(intCount2).strCounty, recBook(intCount2).strPostcode, recBook(intCount2).strTelephone, _
recBook(intCount2).dteHirestart, recBook(intCount2).dteHireend, recBook(intCount2).intCost, _
recBook(intCount2).curTotalcost, recBook(intCount2).strVeh, recBook(intCount2).strID, recBook(intCount2).strReg
intCount2 = intCount2 + 1
Loop
intEntries = intCount2
Close #2
'store the number of records
ErrorHandler:
'if there hasn't been a file created originally then create one
If Err.Number <> 0 Then
Select Case Err.Number
Case 53
MsgBox "(Creating new Booked.txt File)"
Open "A:AssignmentBooked.txt" For Output As #2
Close #2
Exit Sub
Resume
End Select
End If
End Sub
'When you tab off No of days automatically calculate which vehicles are available
Private Sub txtDays_LostFocus()
Dim bolCheck As Boolean
Dim intAge, intCompare1, intCompare2 As Integer
dteHirestart = txtHirestart.Text
txtHireend = DateAdd("d", txtDays, txtHirestart)
cboAvail.Clear
bolCheck = True
intCompare1 = -1
intCompare2 = -1
For intCompare1 = 1 To 20
intCompare2 = 0
If intAge < 21 And recVehicles(intCompare1).strLic = "Over 21 years old" Then
bolCheck = True
Else
bolCheck = False
End If
Do While bolCheck = False And intCompare2 < intEntries
intCompare2 = intCompare2 + 1
If bolCheck = False And recVehicles(intCompare1).strID = recBook(intCompare2).strID Then
If recBook(intCompare2).dteHireend < dteHirestart Or _
recBook(intCompare2).dteHirestart > dteHireend Then
bolCheck = False
Else
bolCheck = True
End If
End If
Loop
If bolCheck = False Then
cboAvail.AddItem recVehicles(intCompare1).strVeh
End If
Next intCompare1
End Sub
'Calculate Date of Birth
Private Sub txtDOB_LostFocus()
Dim intMonths As Integer
Dim sinAge As Single
Dim dteDOB As Date
dteDOB = txtDOB
intMonths = DateDiff("m", dteDOB, Now())
sinAge = intMonths / 12
txtAge.Text = Int(sinAge)
End Sub
Private Sub cmdExit_Click()
frmHire.Hide
Load frmMenu
frmMenu.Show
End Sub
'Calculate total cost of hire
Function Total(Totalcost) As Integer
Totalcost = intDays * recVehicles(intIndex).intCost
End Function
Storing All Keyboard Inputs To Text File
regarding TSR in Windows platform . Can anyone help me to get the code for storing all the keyboard inputs and put it in a text file . i would be very thankfull if you help in this topic.
Need Help ASAP -- Opening A Text File And Storing Info In An Array
I know this has some what been addressed but none of the posts seem to have what I need. Im making a daily log of how many calories you took in and burned off. All you do is just type in the info in textboxs and hit record data and it records it into an array I call MyArray.... Then you can enter the date in the date textbox and call it back up. Now so far Iv been able to save the data thats in the array as a text file but I need some help opening it up. I want to be able to open the text file and simply store the data in the text file back into the array (MyArray) I do this becuase In order to keep the data in the log you would either have to save the array or keep the program open 24/7, i would rather be able to save and open the data. Hope this makes since.
Info about the array:
2-d array called MyArray
Im using opendialog box's to open and savedialogbox to save etc....
the save code looks something like this:
Code:
Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
Dim z, y As Integer
SaveFileDialog1.Filter = "Text File (*.txt)/*.txt"
SaveFileDialog1.ShowDialog()
If SaveFileDialog1.FileName <> "" Then
FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
For c = 0 To 6
For r = 0 To 18
PrintLine(1, MyArray(c, r))
Next r
Next c
FileClose(1)
End If
End Sub
Now I want to take the text file and open it up and simply put it into an array, I dont want to put it into textbox's, just into the array. How would i go about doing this?
Thanks Alot!
P.S Iv included my project in case you need to look at it
Edited by - Capt_Hardcore on 1/22/2004 8:47:30 AM
Storing Arrays
Hello
i'm writing a program which needs to have the arrays saved to disk to be retrieved later.
I've created a type (called shw) with a bunch of sub arrays and variables in in.
I've then created a global array called 'mainshow(2)' of the above mentions type.
How do I go about saving this information to a disk? A friend of mine says there's a function that does it and can reload it, if anyone could give me a direction I'd be very gratefull.
-Nick C
Storing Images In SQL Vs. Storing Path To Image File
I'm writing a document management application whereby users will be able to scan documents into the application. Then from within the applicaiton the users will be able to access the scanned documents.
So the debate is whether I should store the image directly in SQL Server (7.0) or simply store the path to the image and put the image on a network folder.
I have heard people recommend storing only the path and not the image itself but I don't know the reasons.
Obviously the database would be quite large but can't SQL server handle it? Backups would have to be performed either way so... I suppose if the database was corrupted then all images would be lost as opposed to single image files being corrupted on the harddrive.
I guess I'd like to hear what others have done in the past, their opinions, etc.
Thanks in advance.
Storing Double Arrays
well once again im stuck!!
i managed to figure out how to manipulate records in a single table in an access database thru visual basic, however, i have no idea how to store an array of arrays and manipulate that data thru VB
basically...i am making a sport statistics program...
1) the user enters in various player profiles (i have managed to do this effectively using one table and records for each player profile)
2) whenever match statistics are entered in for a player, each should be stored in a separate record
so as you can see...i dont know how to approach this best...if it is possible in Access...can i do an array of player names, and then an array of match statistics in each name? or else what should i do?
im really confused!! lol...please help someone ;o) thanks alot
Storing Arrays In A Table
I am using SQL Server 2005 Express and everything works fine. I have a table with about 10,000 records and want to be able to store a 15 X 15 array for each entry. This array holds floating point values but I could use integers if necessary (eg by multiplying by 1000 so 0.01 is represented by 10, three places of decimals is enough)
Speed is the overwhelming consideration and wonder the best way of doing this?
Ideally I would like to be able to do something like the following:
Code:
Dim sngTest(225) As Single
rstSQL.MoveFirst
sngTest = rstSQL("Array-Here")
sngTest(1) = 0.156
sngTest(225) = 1.235
rstSQL.Update
I appreciate the problem has something in common with storing BLOBS or maybe use the Image Data Type in some way? I don't want to store the arrays as files and just put the file path in the Table as that would be too slow and the arrays are not huge (also could give problems of coordination)
Storing Arrays As Files
i have an array of records (a user defined array i think they call it??) and i want to store it in a file when the program isn't running - so at the beginning it gets the info out of the file and whacks it in the array, then at the end it takes the info from the array and pops it in the file. how do i do this?? it's really confusing cos there seem to be a hundred different types of files and ways of doing it... thanks HEAPS!!
Storing Arrays In Access
I have about 200 element long arrays of integers and floats which I want to store in a database using ADO and visual basic. Storing each element of the array in a separate field really slows down the database access. Is a there a faster way to storing array in an Access database?
Thanks
Text File To Arrays
Simply stated, I want to read a text file with data into an array for use in calculations. I am not an experienced programmer, but this is a pretty straight forward procedure in FORTRAN, but I am beside myself with the process in VB 6. The books I have and sites I've read are great, but they don't deal specifically with reading in data like this or they leave a critical element out, which may be obvious to them but for the uninitiated it is a major obstacle.
I am using the text file as a source which can be updated/modified in order to leave the main program the same. It is a 44 by 51 array (44 columns and 51 rows).
Appreciate any feedback or help.
Arrays Through Text File
Hello, Im pretty much stuck on how to read a text file and than output parts of the text file by putting the first initials in a textbox and then outputting information that starts with the first initials. This is what i got sofar but am stuck on how to complete it. Thanks for the help.
Code:
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
Dim letter As Integer
Dim firstLetter As String
Dim foundFlag As Boolean = False
Dim ltr As String
Dim Read As IO.StreamReader = IO.File.OpenText("Crayons.txt")
lstDisplay.Items.Clear()
For i As Integer = 0 To 50
ltr = txtLetter.Text
'The first name is the string before the first space.
letter = Crayola(i).IndexOf(txtLetter.Text)
firstLetter = Crayola(i).Substring(0, letter)
If firstLetter = txtLetter.Text Then
lstDisplay.Items.Add(Crayola(i))
foundFlag = True
End If
Next
End Sub
End Class
Split Text File Into Arrays
i have a text file containing this text:
Ontani,ontani.no-ip.com,1
this text is loaded into the string textfile
now my question:
How can i split the the string textfile with "," into 3 strings and add them to 3 array's
so the 3 array's should be
Nickname1(0) = Ontani
Ip(0) = ontani.no-ip.com
Status(0) = 1
how can i do this?
can somebody give me an example
i know how to split the file with the "," but don't know how to add into the 3 array's
Greetz From Ontani
Adding From My Text File To My Arrays ?
Hey everybody, I've done a few searches looking for help on this, but to no avail. So, if you could help me out or point me to another thread that'd be great.
My goal is to open and read a txt file in which each line of the file has the following format:
a,b,c
I've figured out how to open my text file and everything, but now I can't figure out how to store the information on each line into 3 different arrays (one for my a, b, and c values). I will later be searching the 'a' array to display the corresponding 'b' and 'c' array value.
Here's what I have so far..
Code:
Private a() As String
Private b() As Decimal
Private c() As Decimal
Private Sub dataLoad()
Dim fileName As String
Dim fileText As String
Dim inFile As IO.StreamReader
Dim maxNdx As Integer = 0
Dim inAsset As String
Dim ndxOf As Integer
fileOFD.ShowDialog()
fileName = fileOFD.FileName
inFile = IO.File.OpenText(fileName)
While inFile.Peek <> -1
fileText = inFile.ReadLine
maxNdx = maxNdx + 1
ndxOf = fileText.IndexOf(",", 0)
inAsset = fileText.Substring(0, ndxOf) & ", "
a(maxNdx) = inAsset
End While
End Sub
Tab Delimited Text File And Arrays
I've seen many threads that talk about tab delimited text files, but none tells me what I need to know.
I have a tab-delimited text file that holds a person's name,email address, and phone number
I need that inputed into a multi-dimension array.
Example:
VB Code:
name(0,0)="Mine"name(0,1)="example@example.com"name(0,3)="555-1212"
what would be the easiest way to do this?
- Comparing 2 Arrays (DB && Text File)
I'm not very good with arrays.
I'm trying to read data in a text file and read data in a database. Store both in an array and then subtract the difference - by this i mean:
DB:________Text File:________Output:
1_____________1_______________4
2_____________2_______________5
3_____________3
4
5
Then, the remaining Output Figures above (4,5) - process them
The database will always have equal or more values. here is the code I have so far.
Code:
Private Sub GetDBInfo()
Dim sql1 As String 'sql statement
Dim arr As Variant
Dim a, b, i
Dim r As Integer
Dim c As Integer
Dim cnSess As ADODB.Connection 'ADO Connection Object
Dim rs As ADODB.Recordset
Dim errLoop As ADODB.Error 'ADO Error object
Dim strError As String
'MS ACCESS DB........................................................................
Set cnSess = New ADODB.Connection
With cnSess
.Provider = "Microsoft.JET.OLEDB.4.0"
.ConnectionString = App.Path & "DB.mdb"
.Open
End With
'OPEN RECORDSET
Set rs = New ADODB.Recordset
rs.Open "SELECT ID FROM TABLE1", cnSess, adOpenKeyset, adLockOptimistic
b = rs.RecordCount
If b > 0 Then
arr = rs.GetRows
'UGLY - NEEDS REFINING
For r = LBound(arr, 2) To UBound(arr, 2)
For c = LBound(arr, 1) To UBound(arr, 1)
MsgBox (arr(c, r))
Next c
Next r
End If
'CLEAN UP DB
cnSess.Close
Set cnSess = Nothing
End Sub
Private Sub GetTextValues()
Dim sID As Integer
Dim r As Integer
Dim c As Integer
Dim arr1 As Variant
Open App.Path & "TextFile.txt" For Input As #1
Do While Not EOF(1)
'NEED HELP HERE STORING INTO ARRAY
Input #1, sID
msgbox sID
Loop
Close #1
End Sub
Edited by - pbeast on 1/2/2007 6:55:46 AM
Parsing Text File Into Arrays
Hi
i have the following data in a text file called data.txt
abc 123 Program Files est.txt
def 456 Program Files est2.txt
I would like to load the info from the text file and put it in 3 arrays called letterArray() numberArray() and locationArray().
Does anybody know how i can seperate the 3 parts of information from the text file and place the data into the arrays
Cheers
eVBExplorer
Best Method For Loading Text File Into Arrays
All,
I have a program that tracks equipment transfers from one account to another. I have a comma delimited text file named ADPE.txt that stores the account numbers, equipment custodians, EC extensions, Alternate ECs, and the alternate EC extensions; in that order.
I have 5 corresponding arrays: Account, EC, ECExt, AltEC, AltECExt.
Code:
Option Explicit
'Arrays for ADPE database
Dim Account(0 To 71) As String
Dim EC(0 To 71) As String
Dim ECExt(0 To 71) As String
Dim AltEC(0 To 71) As String
Dim AltECExt(0 To 71) As String
And then on Form_Load:
Code:
Private Sub LoadADPEArray()
'Loads Accounts, ECs, and extensions from ADPE text file
Dim i As Integer
Open "G:SCXSCX Programadpe.txt" For Input As #1
For i = 0 To 71
Input #1, Account(i), EC(i), ECExt(i), AltEC(i), AltECExt(i)
Next i
Close #1
End Sub
The arrays go 0 to 71, and the Loop goes 0 to 71 because there are 72 lines in the text file.
HOWEVER, I am finding that the information in the text file is changing frequently. I mean that I am adding or deleting lines out of it frequently.
So, my question is what is the best method to load the text file into the arrays and allow me to change the text file without having to recode the program? I tried using the code:
Code:
For i = 0 to EOF(1)
But the arrays never loaded.
Also, any constructive criticism on a better method to arrange my arrays will be much appreciated.
Storing Data In And Recalling The Data From A Single Database Record
hi guys...
I am still working on the same system but on another part of it.
I need to know how I can have some numbers in text boxes or other controls, so that when the app is closed, the numbers get stored in a database record, or some other data sheet, and then get called back up wheb the program is reopened
I actually have access to some code that was writting for another part of this system, but I don't understand a lot of it
Anyway... I need to know how to have these numbers stored automatically when the app is clsed, and then recalled automatically next time the app is opened.
Thank you so much
Happieman
Import Data From A Text File Into VB Form In Order To Process That Data
I'm trying to import Data from a text file, which includes the following,
Vessel Name
000115600
000025600
000000000
000089000
000019000
000000000
6670.43
The above file is updated every five minutes and I wish to retreive this data in order to perform calc's and then display a completion time for a process on the User Form.
Can you please help.
Cheers
Saving Data In Text File With Out Overwriting The Current Data ?
Hi .........
First .. I will explain the purpose of this Needs , and i will ******** every point
1. I have 2 text files :
A. DatabaseBakups.txt 'Hold all names of all Access Database which i have in my directory
B. CurrentDataBase.txt ' store the name of the current Access used file
2. In my Maintainance section there is to option :
A. Backup the Database 'with command button to save the current running database and in same time store that name into DatabaseBakups.txt file
B. Restore Database ' with combo list which have the list of all database i have and should be readed from DatabaseBakups.txt
The Actions :
3. when the user select to backup the database .... the system will give a specific name 4 the database e.g. "DB30-05-02.mdb" and in same time store that name into DatabaseBakups.txt with out overwriting the existing data .......
4. when the user want to recover/restore some of previous database ..... there is list box which is extracting the data from DatabaseBakups.txt and giving the users the alternative to choose the month or the date of backup to restore the database ....
my questions :
1. how to write a code for inserting data to txt file with out overwriting the existing data ???
i used this simpe one but that will overwrite all exisitng data :
Open App.Path & "DatabaseBakups.txt" For Output As #1
Write #1, "DB30-05-02.mdb";
Close #1
2. How to load the data from file "DatabaseBakups.txt" to the list box ??
I know that I wrote a story of my problem ..... but i believe that will help the person to understand my needs ......
Thanks In Advance 4 help
Regards
BMH
Processing Text Files (FINDING AND REPLACING DATA INSIDE A TEXT FILE)
Hi
I would appreciate if some one help me out in finding an answer to this.
I am a new user of visual basic and have been stuck in writing a code / project for finding and replacing a data from a text file ( input file to an application).
The part of file sample which need to be replaced is below
SCJ 1 NAME "" TYPE FIXED_TIME CYCLE_TIME 61.0 OFFSET 0.0
SIGNAL_GROUP 1 NAME "" SCJ 1 RED_END 2.0 GREEN_END 26.0 TRED_AMBER 0.0 TAMBER 4.0
For example I need to replace 61.0 to 91.0 and 26.0 to 43.0.
The data in file is random and can come at any line number, one of my other concern is how to locate the line number, I have no clue for that.
Please help me in working this out.
Best Regards
Abdy
Sorting Data From An ASCII Text String And Saving It As Text File
Hi,
I'd first like to copy paste a section of my ASCII text string over here and then ask the question.Given below is the ASCII text string:
RT 01 A_UNIT
DEV 01 A_UNIT
=ontrol Mode ON LOCAL STAT
Occupied YES OCC
CCN Chiller START CHIL_S_S
Alarm State Normal ALM
Active Demand Limit 100 % DEM_LIM
Override Modes in Effect YES MODE
=
=?
RT 01 CIRCA_AN
DEV 01 CIRCA_AN
=IRCUIT A ANALOG VALUES
Percent Total Capacity 100 % CAPA_T
Percent Available Cap. 100 % CAPA_A
Circuit Running Current 185 AMPS A_CURR
Discharge Gas Temp - A2 122.9 dF DISTMPA2
Saturated Condensing Tmp 97.5 dF TMP_SCTA
Saturated Suction Temp 41.5 dF TMP_SSTA
EXV % Open 43 % EXV_A
Variable Head Press Pct. 0 % VHPA
=
=?
Given above is a portion of my ASCII text string.I'd like to know how to sort out the data from this file and copy it in the same format as given above into a new Text File,using the delimiting characters like the white space and the "?".The "?" indicates the end of the file and the following ASCII text string after every "?" indicates the start of a new text file.
I'd be very very grateful to the person who'd give me the solution to this.Thanking you in anticipation.
Storing Data
I poseted this on a diffrent post however I think I was supposed to post it here. Here is what I posted:
Hi,
I am curently writing a program that will keep track of classes that people take. So far all I made was the GUI. You can look at it by going here [NO DIRECT LINKS TO EXES PLEASE] . I don't know how to store data. If you look at the program pretty much people will be able to add a class that they took, the date they took it, the course number and how many CEU's (aka points) the class is wotrh. I want to figure out a way to take the data from the text store it on the computer in a file or in the reg. and when the program is turned back on it is placed into the lavels on the form. I am still a newbie. I do not know how to use data grids. As of now I will be placing 20 labels for each section (i.e. class name, date taken etc.) And when it pulls the info it will see how many classes are taken and fill the appropiate amount of labels. The rest of the labels will be set to be hidden. I know a little bit on how to work with a .db file. The problem is that all the code needs to be in one exe. I need step by step directions. Can anyone help.
Thanks.
AND
Ok. I now realize why people wouldnt want to download an EXE. Here is a screen shot of the program. Http://www.emstalk.com/downloads/ceutracker.jpg.
Here is the form
Http://www.emstalk.com/downloads/MainForm.frm
There is no "real" code in it since I did not know how I would store and retrieve the data.
Here is the source code
Code:
Private Sub IDontWork()
MsgBox "I Don't work yet"
End Sub
Private Sub Command1_Click()
Call IDontWork
End Sub
Private Sub Command2_Click()
Call IDontWork
End Sub
Private Sub Command3_Click()
Call IDontWork
End Sub
Private Sub Form_Load()
CMonth.AddItem "01"
CMonth.AddItem "02"
CMonth.AddItem "03"
CMonth.AddItem "04"
CMonth.AddItem "05"
CMonth.AddItem "06"
CMonth.AddItem "07"
CMonth.AddItem "08"
CMonth.AddItem "09"
CMonth.AddItem "10"
CMonth.AddItem "11"
CMonth.AddItem "12"
CDay.AddItem "00"
CDay.AddItem "01"
CDay.AddItem "02"
CDay.AddItem "03"
CDay.AddItem "04"
CDay.AddItem "05"
CDay.AddItem "06"
CDay.AddItem "07"
CDay.AddItem "08"
CDay.AddItem "09"
CDay.AddItem "10"
CDay.AddItem "11"
CDay.AddItem "12"
CDay.AddItem "13"
CDay.AddItem "14"
CDay.AddItem "15"
CDay.AddItem "16"
CDay.AddItem "17"
CDay.AddItem "18"
CDay.AddItem "19"
CDay.AddItem "20"
CDay.AddItem "21"
CDay.AddItem "22"
CDay.AddItem "23"
CDay.AddItem "24"
CDay.AddItem "25"
CDay.AddItem "26"
CDay.AddItem "27"
CDay.AddItem "28"
CDay.AddItem "29"
CDay.AddItem "30"
CDay.AddItem "31"
CYear.AddItem "00"
CYear.AddItem "01"
CYear.AddItem "02"
CYear.AddItem "03"
CYear.AddItem "04"
CYear.AddItem "05"
CYear.AddItem "06"
CYear.AddItem "07"
CYear.AddItem "08"
CYear.AddItem "09"
CYear.AddItem "10"
CYear.AddItem "11"
CYear.AddItem "12"
CYear.AddItem "13"
CYear.AddItem "14"
CYear.AddItem "15"
CYear.AddItem "16"
CYear.AddItem "17"
CYear.AddItem "18"
CYear.AddItem "19"
CYear.AddItem "20"
CYear.AddItem "21"
CYear.AddItem "22"
CYear.AddItem "23"
CYear.AddItem "24"
CYear.AddItem "125"
End Sub
Storing Data
I never understood how to do this, but I now require it.
I need to be able to save several stats into a file and call them all up upon login. It is not over the internet (although in the future it'll probably have to be saved over a network). The stats include a username, password, and a set of 6 stats (administrative and program access powers) dependent on the first stat (I called it level).
I read the microsoft help file and now I'm not sure whether I am coming or going.
Help?
Storing Data In Exe
I've got a body of data that I want to use in a dll. The body of data is created by a small computer program which is an add-in to VB. I'm wondering what the best way to store this data is. I'd rather package the data into the dll than have it in a separate file that I would have to distribute in addition to the dll. I just think that's neater and more robust. Anyway I've thought of the following options:
1. Keeping each item of data as a string in a resource file. The problem is that I don't think you can add to a resource file with a VB add-in. So that doesn't seem viable.
2. Making a text file, and adding that as a custom resource to a text file. I don't like the fact that you have to extract the whole text file each time you want to examine it - I think this could be slow. Plus, I don't think I can look at the text file without running the dll.
3. Adding a form to the dll with a combo box which lists all the records. The form would never be shown, so this seems a bit of an odd thing to do. But it certainly works, and the add-in can handle it.
I'm coming down in favour of No. 3. Anyone have any thoughts? Is there a more professional way to handle this?
Thanks for your help.
Storing Data In An Exe
Hi' Firstly an apology for not knowing the proper section to post this in as my BV knowledge is minimal.
Here's my problem.
I have a small program that once executed reads a file on my hard drive and then stores the contents in a string variable. The program works fine but it really annoys me that there are two files when I would much prefer the data to be compiled in the exe instead of having to read it from a file.
To date the best I have managed is to put the data file into an OLE as a Package but I cannot find any way to transfer the contents of the OLE Package to a string variable.
Any help with this would be most appreciated.
Thanks in advance.
|