|
-
Nov 15th, 2012, 09:30 PM
#1
Thread Starter
Frenzied Member
How can I store a large string in visual basic 6 (in runtime?)
I want to have a standalone exe that has a large string (~1mb) of data. What is the best way to do this?
The textbox has a limit of ~65000 characters.. and you cannot simply write in the IDE
someString = 1mbworthofdata
How can you store a large string in a program without having to resort to loading the data from a file?
-
Nov 15th, 2012, 10:19 PM
#2
Re: How can I store a large string in visual basic 6 (in runtime?)
A String can hold around ~1GB-2GB of data maximum. Read it here: http://www.vbforums.com/showthread.p...-string-in-VB6
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Nov 15th, 2012, 10:25 PM
#3
Re: How can I store a large string in visual basic 6 (in runtime?)
I think he wants a control to avoid asigning the String to the variable in code, if so, you can place as many text as you want in a the RichTextBox Control, quick test with 5 million chars:
Code:
rtb.Text = String(5000000, "A")
Last edited by jcis; Nov 15th, 2012 at 10:28 PM.
-
Nov 15th, 2012, 10:29 PM
#4
Re: How can I store a large string in visual basic 6 (in runtime?)
Technically even if you have the data embedded in the exe you are still going to be loading it from a file, it just happens to be the same file that contains the exe
-
Nov 15th, 2012, 11:04 PM
#5
Thread Starter
Frenzied Member
Re: How can I store a large string in visual basic 6 (in runtime?)
datamiser: but how would i read it?
jcis: id like to do that but i dont want to add another reference/ocx to the richtextbox
akhileshbc: i know a string can load that large amount of data, but how would i do that without a textfile?
any other ideas?
-
Nov 15th, 2012, 11:18 PM
#6
Re: How can I store a large string in visual basic 6 (in runtime?)
What is your exact requirement ? Do you want to keep a big data that you generated in your program till the program terminates ? Or is it like you want to read the big data for some manipulation in your program? Or is it like you want to display it to the user ?
If your requirement is to read the data and do some manipulations using it, then try this idea:
If your data has a specific structure, then you could keep the data in a file and use the Random Access mode to read specific records from the file. That is to read a specific data, seek to the record to which you want to read, then read the record. If you want to change, then change it and so on.
Read this: http://www.thevbprogrammer.com/Ch06/...andomFiles.htm
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Nov 15th, 2012, 11:31 PM
#7
Thread Starter
Frenzied Member
Re: How can I store a large string in visual basic 6 (in runtime?)
i dont want to use a file though - i just want one standalone exe
-
Nov 15th, 2012, 11:40 PM
#8
Re: How can I store a large string in visual basic 6 (in runtime?)
 Originally Posted by qpabani
i dont want to use a file though - i just want one standalone exe
If you wish to distribute your application as a single EXE file, then you could try embedding it to your application resource. Then at runtime, extract it to a temp location and use that file. After use, remove the file from the temp location.
Read this: http://www.thevbzone.com/l_res.htm
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Nov 15th, 2012, 11:45 PM
#9
Re: How can I store a large string in visual basic 6 (in runtime?)
You can put your data into a file, and then use this file as the basis for a Custom resource during development. Use the LoadResData() function at runtime to retrieve it into a dynamic Byte array.
If it is really text and limited to ANSI or the ASCII subset, you can save space by creating your file as ANSI and after loading it from the resource use StrConv() to translate it to Unicode for use and assign it to a String. If it is text but Unicode, you can omit conversion but you may have to skip over the BOM if you have one:
Code:
'Examples showing the use of custom "text" resources. Here
'I just use them to fill two TextBox controls:
'Notepad and most Windows editors don't create a BOM for ANSI
'files since there isn't one defined. So the entire resource
'consists of ANSI text:
Text1.Text = StrConv(LoadResData("ANSI", "TEXT"), vbUnicode)
'UTF-16LE "Unicode" text files normally have a 2-byte BOM.
'If we used Notepad to create this resource we'll want to
'strip it here:
Text2.Text = Mid$(LoadResData("UNICODE", "TEXT"), 2)
For binary data just assign to a dynamic Byte array.
-
Nov 16th, 2012, 01:28 AM
#10
PowerPoster
Re: How can I store a large string in visual basic 6 (in runtime?)
Don't work with a Byte addressed data type. Just use a String, so then Dim your variable as a String, then you will then be able to make it possible to store up to a whopping 1Gb of ASCII data...
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Nov 16th, 2012, 09:25 AM
#11
Re: How can I store a large string in visual basic 6 (in runtime?)
Theimp - follow the bouncing ball.. in order to assign it to the string, it has to BE SOMEWHERE FIRST... and that's what the OP is trying to figure out...
Personally, I vote for the embedded resource, extract, read method... but at the same time... I gotta wonder ... what kind of string data is that large? 
-tg
-
Nov 16th, 2012, 04:30 PM
#12
Re: How can I store a large string in visual basic 6 (in runtime?)
I'm guessing the next question will end up being "How to update?" the resource at runtime.
There usually just isn't a good reason to load up an EXE with large blobs of data like this anyway.
-
Nov 16th, 2012, 06:25 PM
#13
PowerPoster
Re: How can I store a large string in visual basic 6 (in runtime?)
You can also attach a String together, using this following example:
Code:
Dim String1 As String
Dim String2 As String
.
.
.
frmMain.Text1.Text = String1 & " " & String2
This will then be able to give you a 1Gb plus more of the data, that you can display, but not store inside the very same variable. Just you have to make them String data types. In which you are able to have a 1Gb of data inside them each. Thus totalling up to 2Gb in size...
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Nov 16th, 2012, 06:39 PM
#14
Addicted Member
Re: How can I store a large string in visual basic 6 (in runtime?)
-
Nov 16th, 2012, 06:47 PM
#15
PowerPoster
Re: How can I store a large string in visual basic 6 (in runtime?)
Yes ofcourse a data base is able to store even more data that 1Gb...
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
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
|