|
-
May 3rd, 2005, 06:45 PM
#1
Thread Starter
PowerPoster
[RESOLVED] txt files (writing to and retrieving from)
Ok. I have searched the forums a few times and havent found anything that assists me with my question.
I am going to be adding a tab to my SSTab whereby it has two input fields and one button.
lets just say the input fields are called InputField1.text and InputField2.text
What I would like to do is when you enter something into both input fields and click on the form button, it saves those values to a text file in the format of:
InputField1.value, InputField2.value
Then, when someone enters a value into one of the input fields within one of the other tabs, it searchs for the word in either column, and then shows its counterpart in a labal caption.
How would this be done?
Last edited by BrailleSchool; May 7th, 2005 at 01:46 AM.
-
May 3rd, 2005, 06:49 PM
#2
Re: txt files (writing to and retrieving from)
If you use a db for the dictionary, you could run a query to search any field, depending on which tab the textbox is filled in from. You could also have definitions in each language in the same record.
-
May 3rd, 2005, 06:51 PM
#3
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by dglienna
If you use a db for the dictionary, you could run a query to search any field, depending on which tab the textbox is filled in from. You could also have definitions in each language in the same record.
I currently have many of the records in a MySQL database, the only thing is, when I distribute the VB6 app, they would have to specify a connection param to the DB. I was thinking of having it access the txt file to get the records and then displaying them. Also giving the ability to add additional words.
-
May 3rd, 2005, 07:02 PM
#4
Re: txt files (writing to and retrieving from)
Well reading a large text file is a slow process. I also think you should use a database. You could use an Access database so you only need to distribute the mdb file, the user doesn't have to have Access installed.
-
May 3rd, 2005, 07:04 PM
#5
Re: txt files (writing to and retrieving from)
If they are single words, I guess you could use a two-dimensional array. You may want to look at using a collection, also, as you could use a UDT that contained both definitions, except there would only be one key.
-
May 3rd, 2005, 07:08 PM
#6
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by Joacim Andersson
Well reading a large text file is a slow process. I also think you should use a database. You could use an Access database so you only need to distribute the mdb file, the user doesn't have to have Access installed.
If it was to be a text file, it would have something like 14,000 lines in the format of
value,value
-
May 3rd, 2005, 07:13 PM
#7
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by dglienna
If they are single words, I guess you could use a two-dimensional array. You may want to look at using a collection, also, as you could use a UDT that contained both definitions, except there would only be one key.
example:
tab 0
if you inputted into txtEnglish.text the following word:
chuckle
then the caption for lblIrish would be déan maolgháire
and the line in the txt file would be
chuckle, déan maolgháire
tab 1
if you inputted déan maolgháire into txtIrish.text then the caption for
lblEnglish would be chuckle (from same text file.)
-
May 3rd, 2005, 07:14 PM
#8
Re: txt files (writing to and retrieving from)
 Originally Posted by BrailleSchool
If it was to be a text file, it would have something like 14,000 lines in the format of
value,value
Think how much time it would take to read each line every time you want to look up a word. Of course you could read it in only once but that would mean you would store two arrays containing 14,000 records each in memory which is a waste. Use a database instead, since this is a desktop application an Access database would be perfect.
-
May 3rd, 2005, 07:19 PM
#9
Re: txt files (writing to and retrieving from)
I agree. Use ADO to connect to a DB and you will be able to search either field very quickly, as well as include other fields in the same record.
-
May 3rd, 2005, 07:20 PM
#10
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by Joacim Andersson
Think how much time it would take to read each line every time you want to look up a word. Of course you could read it in only once but that would mean you would store two arrays containing 14,000 records each in memory which is a waste. Use a database instead, since this is a desktop application an Access database would be perfect.
i have no experience with Access.
-
May 3rd, 2005, 07:22 PM
#11
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by dglienna
I agree. Use ADO to connect to a DB and you will be able to search either field very quickly, as well as include other fields in the same record.
the current program uses ADO, and I have the connection string within the app and in the third input box on the ado control. having said that, each person who gets the app would have to configure the database connection which is not a good thing.
-
May 3rd, 2005, 07:23 PM
#12
Re: txt files (writing to and retrieving from)
 Originally Posted by BrailleSchool
i have no experience with Access.
Do you know how to use ADO? Converting the MySQL db into an Access db should not cause any problem. It sounds as if you only need one very simple table.
-
May 3rd, 2005, 07:25 PM
#13
Re: txt files (writing to and retrieving from)
All users can use the same connection string with ADO, so they'd be able to open the db as long as it was installed in the correct/expected location on their machine.
-
May 3rd, 2005, 07:26 PM
#14
Re: txt files (writing to and retrieving from)
 Originally Posted by BrailleSchool
the current program uses ADO, and I have the connection string within the app and in the third input box on the ado control. having said that, each person who gets the app would have to configure the database connection which is not a good thing.
No, they don't have to do that if you're using a simple Access database. Since you can put that in the same folder as the application. The connection string would look simular to this:
VB Code:
sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\theMDBFile.mdb;"
-
May 3rd, 2005, 07:28 PM
#15
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by dglienna
All users can use the same connection string with ADO, so they'd be able to open the db as long as it was installed in the correct/expected location on their machine.
the mysql db is located on my server that is located in FL so they would have to have WWW access to be able to get to the db.
I am trying to think of ways that would be more convenient for the user(s)
theMDBFile.mdb being the db?
-
May 3rd, 2005, 07:31 PM
#16
Re: txt files (writing to and retrieving from)
 Originally Posted by BrailleSchool
theMDBFile.mdb being the db?
Yes, you would probably want to call it something else Dictionary.mdb perhaps?
-
May 3rd, 2005, 07:46 PM
#17
Re: txt files (writing to and retrieving from)
Wouldn't you want a local version using the mdb as well as a version that runs on the Internet? You could evn have no program necessary to run off the Internet.
-
May 3rd, 2005, 07:55 PM
#18
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by dglienna
Wouldn't you want a local version using the mdb as well as a version that runs on the Internet? You could evn have no program necessary to run off the Internet.
Preferably the program would have some kind of db that you didnt have to have www access to be able to use (use online or offline)
with as little or no user configuration as possible
What I would love is:
1) user downloads the program
2) double clicks the icon to execute
3) automatically use
if there are updates to the dictionary file (db or what ever) then i can always use some kind of auto update program to update the words list (there is a prog that does this in the code bank)
Last edited by BrailleSchool; May 3rd, 2005 at 07:59 PM.
-
May 3rd, 2005, 07:59 PM
#19
Re: txt files (writing to and retrieving from)
Maybe the web version would have updates, but you should also be able to dowbload updates that get inserted into the local db. You could use sql to insert, delete, or change the db. I see no reason to need the web mysql db, though.
-
May 3rd, 2005, 08:05 PM
#20
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by dglienna
Maybe the web version would have updates, but you should also be able to dowbload updates that get inserted into the local db. You could use sql to insert, delete, or change the db. I see no reason to need the web mysql db, though.
I am just thinking for the convenience of use for a user. The user also not knowing the access credentials to a database.
If you used an access database on a local machine (127.0.0.1) then would they have to install anything on their machine to be able to access and use the database format or is the mdb file good enough?
-
May 3rd, 2005, 08:10 PM
#21
Re: txt files (writing to and retrieving from)
You would only need the MDB file, and for an Access database you don't specify an IP address you simply specify the local path to the MDB file. Access is not a RDBMS system.
-
May 3rd, 2005, 08:13 PM
#22
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by Joacim Andersson
You would only need the MDB file, and for an Access database you don't specify an IP address you simply specify the local path to the MDB file. Access is not a RDBMS system.
so a path would be something like C:\Program Files\Translator\Dictionary.mdb?
Does Microsoft Access have anything to do with the creation of the MDB files? (The Access that comes with MS Office?)
-
May 3rd, 2005, 08:17 PM
#23
Re: txt files (writing to and retrieving from)
You can create the same thing with Office Access, or using ADO. You can create it with Access, and then read it with VB.
-
May 3rd, 2005, 08:20 PM
#24
Re: txt files (writing to and retrieving from)
If you like I can help you convert the MySQL data into an Access database. I only need to know the layout of the table and the connection string you would use for the MySql database.
-
May 3rd, 2005, 08:27 PM
#25
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by dglienna
You can create the same thing with Office Access, or using ADO. You can create it with Access, and then read it with VB.
if i created the db with office access, would you have to have office access installed or just have the mdb file in the right location?
-
May 3rd, 2005, 08:28 PM
#26
Re: txt files (writing to and retrieving from)
Just VB and the mdb file. The installer installs everything that you need. (I usually use Inno, though)
-
May 3rd, 2005, 08:33 PM
#27
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by dglienna
Just VB and the mdb file. The installer installs everything that you need. (I usually use Inno, though)
what is inno?
-
May 3rd, 2005, 08:36 PM
#28
Re: txt files (writing to and retrieving from)
 Originally Posted by BrailleSchool
if i created the db with office access, would you have to have office access installed or just have the mdb file in the right location?
Didn't you read the earlier replies 
 Originally Posted by Joacim Andersson
You could use an Access database so you only need to distribute the mdb file, the user doesn't have to have Access installed.
Also, as I suggested earlier you should put the MDB file in the same folder as the application is installed so you can use App.Path to get the path to it.
-
May 3rd, 2005, 08:37 PM
#29
Re: txt files (writing to and retrieving from)
 Originally Posted by BrailleSchool
what is inno?
InnoSetup is a great freeware installer.
-
May 3rd, 2005, 08:39 PM
#30
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by Joacim Andersson
Didn't you read the earlier replies 
Also, as I suggested earlier you should put the MDB file in the same folder as the application is installed so you can use App.Path to get the path to it.
my screen reader must have missed it
-
May 3rd, 2005, 08:40 PM
#31
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by Joacim Andersson
ill have to check it out
-
May 3rd, 2005, 08:42 PM
#32
Re: txt files (writing to and retrieving from)
 Originally Posted by BrailleSchool
my screen reader must have missed it
Oh, I'm sorry I didn't know you needed a screen reader.
-
May 3rd, 2005, 08:53 PM
#33
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by Joacim Andersson
Oh, I'm sorry I didn't know you needed a screen reader.
no apology needed.
-
May 3rd, 2005, 08:54 PM
#34
Member
Re: txt files (writing to and retrieving from)
Are you making a guitar tab writer?
-
May 3rd, 2005, 09:03 PM
#35
Thread Starter
PowerPoster
Re: txt files (writing to and retrieving from)
 Originally Posted by m0ney$
Are you making a guitar tab writer?
Nope, making a translator from English to Irish Gaelic and from Irish Gaelic to English (using SSTab) and soon to be an access db
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
|