|
-
Sep 7th, 2000, 12:43 PM
#1
Thread Starter
Lively Member
How do i open a file more than 1meg in size and display its contents in a textbox??
much appreciated!!
-
Sep 7th, 2000, 12:55 PM
#2
Monday Morning Lunatic
A textbox can't display that much text. It's not the buffer, it's because it can't reference that high a number. You'd need to use a RichTextBox instead.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 7th, 2000, 01:22 PM
#3
Frenzied Member
Be sure to...
...open the file in binary mode
http://www.vb-world.net/files/openstatement/
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 7th, 2000, 01:50 PM
#4
Addicted Member
...or using the command
Text1.Loadfile ("C:\largefile.txt")
I know this is (for some reason) not so popular among many programmers, but it works well for me.
Wilhelm Tunemyr,
Swede in London
[email protected]
"Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menschen"
Heinrich Heine (1797-1856)
Pravda vítezi!
(Truth prevails!)
-
Sep 7th, 2000, 01:54 PM
#5
Frenzied Member
nah...
The reason I told him to use Binary mode is because I heard it was alot faster than the other methods, ok, your's is easier but for large files I believe it's better to use Binary, and it sounds cool
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 7th, 2000, 01:58 PM
#6
Thread Starter
Lively Member
the textbox doesn't have a method call loadfile
i got an error message trying
Text1.Loadfile("C:\somelargefile.txt")
-
Sep 7th, 2000, 02:03 PM
#7
Frenzied Member
It's meant for the RichTextBox from Microsoft (Press CTRL + T) and add it to your project.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 7th, 2000, 02:19 PM
#8
Thread Starter
Lively Member
oh....
one last things.. how much data can the rich text box hold...
in other words.. is there a limit on the file size i can display in the RTB?
Much Appreciated
-
Sep 7th, 2000, 02:45 PM
#9
I think its 2 or 3 gigabytes....
-
Sep 7th, 2000, 04:09 PM
#10
Hyperactive Member
I think that 2-3 GB is enough and nobody enters that much text.
every char on a textbox is one Byte, so imagine 1 MB is 10000000 Bytes, so it's like 10000000 characters. 1000 MB is 1000 MB. so it's 100000000000 characters. Times 3 it's 300000000000 characters, and that's a lot!
Summary:
1 Byte = 1 Char
1 MB = 10000000 Chars
1 GB = 10000000000 Chars
3 GB = 30000000000 Chars
30000000000 chars is a lot!!!
More posts for me!
-
Sep 8th, 2000, 10:18 AM
#11
Addicted Member
Originally posted by Jop
The reason I told him to use Binary mode is because I heard it was alot faster than the other methods
Well, I use RichTexBox and LoadFile, and it only took a few seconds to open a Mp3-file of 3800 kB.
So it's fast enough.
Pentax
Wilhelm Tunemyr,
Swede in London
[email protected]
"Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menschen"
Heinrich Heine (1797-1856)
Pravda vítezi!
(Truth prevails!)
-
Sep 8th, 2000, 10:25 AM
#12
Frenzied Member
Well, I use RichTexBox and LoadFile, and it only took a few seconds to open a Mp3-file of 3800 kB.
So it's fast enough.
Ohh it probably uses Binary mode too then 
Sorry for the incovidence...
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 8th, 2000, 04:46 PM
#13
Addicted Member
it probably uses Binary mode too then
Well, that's of course possible.
I thought of Open file As Binary and all that stuff when you wrote open in binary mode.
What does incovidence mean?
Pentax
Wilhelm Tunemyr,
Swede in London
[email protected]
"Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menschen"
Heinrich Heine (1797-1856)
Pravda vítezi!
(Truth prevails!)
-
Sep 8th, 2000, 05:41 PM
#14
Member
Binary mode speed
You try loading a file byte by byte from a file nto RAM - It's very slow
-
Sep 8th, 2000, 06:26 PM
#15
Frenzied Member
Well, that's of course possible.
I thought of Open file As Binary and all that stuff when you wrote open in binary mode.
What does incovidence mean?
Pentax
I meant the LoadFile method, I mentioned Open File ... As Binary before. That was not what I meant mate
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 8th, 2000, 06:44 PM
#16
So Unbanned
Originally posted by Asaf_99
Summary:
1 Byte = 1 Char
1 MB = 10000000 Chars
1 GB = 10000000000 Chars
3 GB = 30000000000 Chars
30000000000 chars is a lot!!!
You're wrong.
1 char = 8 bits
8 bits = 1 byte
1024 bytes = 1 KB
1,048,576 bytes = 1 MB(1024 KB)
1,073,741,824 bytes = 1 GB(1024 MB)
1,099,511,627,776 bytes = 1 TeraByte(TB, 1024 GB)
You get the picture I hope.
1024 / 8 = 128
multiples of two!
128 / 2 = 64
62 / 2 = 32
..16
..8
..4
..2
..1
If it were:
1000 / 8 = 125
125 / 2 = 62.5
you can't have 62.5 bits!
-
Sep 8th, 2000, 06:50 PM
#17
Frenzied Member
1 char = 8 bits
8 bits = 1 byte
So that'll make 1 Char = 1 byte Isn't that the same as Asaf_99 said?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 8th, 2000, 06:54 PM
#18
So Unbanned
Yes, 1 character is 1 byte, but 1000 bytes is not a kilobyte, it takes 1024 byte to make a kilobyte.
-
Sep 8th, 2000, 06:58 PM
#19
Frenzied Member
Yeah I overlooked that part in his post, sorry!
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 9th, 2000, 11:15 AM
#20
Monday Morning Lunatic
On type names:
4 bits = 1 nibble
2 nibbles = 1 byte
And here's the explanation for why a text-box can't load more than 64K:
The text box is one of the original Windows controls, and as such, is 16bit. This means it can only address a maximum of 2^16 bytes = 65536 bytes. The RichTextBox is 32bit, so it can use 2^32 bytes = 4294967296 bytes (4 gigs).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
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
|