TextBoxes

  • Thread starter Thread starter MSDousti
  • Start date Start date
M

MSDousti

Hi everybody
Textboxes in VS behave in a strange way! I have set the "maximum"
property of the textbox to 0, letting virtually no limitation for the
text entered in it.

I put an OpenDialogFile on the form, and a TextBox.
The following code is used to open the file into the textbox:

If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
Dim sr As New IO.StreamReader(OpenFileDialog1.FileName)
TextBox1.Text = sr.ReadToEnd
sr.Close()
End If

This works really fine in WINDOWS XP.

But in WINDOWS 98, when I open a file- larger than about 33KB- without
any error, nothing appears in the textbox. For files less than 33KB
the code works fine. (I can open files larger than 2^15 = 32768)

What can I do?
 
Hi MS,

Here's the question: can you append characters to the text in the textbox
that has reached its limit? If the answer is yes, then it's simply a matter
of getting the file in 32k chunks and appending to a string object and then
inserting it into the textbox. On the other hand, if you can't, then the 16
bit elements of win 98 will simply not let you and you may be unable to do
anything about it.

Another idea: test dumping sr.readtoend into a string to see if the string
variable can take it - that way you can determine if the string in 98, as
opposed to the textbox.text, is the limitation.

HTH,

Bernie Yaeger
 
some versions of text boxes have caracter length limitations... some have
32K limitation... so if you put 33K into it, there will be an exception
which would cause nothing to show... i think 9x worked that way..
 
* (e-mail address removed) (MSDousti) scripsit:
Textboxes in VS behave in a strange way! I have set the "maximum"
property of the textbox to 0, letting virtually no limitation for the
text entered in it.

I put an OpenDialogFile on the form, and a TextBox.
The following code is used to open the file into the textbox:

If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
Dim sr As New IO.StreamReader(OpenFileDialog1.FileName)
TextBox1.Text = sr.ReadToEnd
sr.Close()
End If

This works really fine in WINDOWS XP.

But in WINDOWS 98, when I open a file- larger than about 33KB- without
any error, nothing appears in the textbox. For files less than 33KB
the code works fine. (I can open files larger than 2^15 = 32768)

That's a limitation for the TextBox control on Windows 98/Me. You may
want to use a RichTextBox control instead which can hold much more data.
 
Ken Tucker said:
Hi,

Why dont you try the richtextbox instead.

RichTextBoxes are very slow!
for example, a 1MB file which takes about 1 Second to load into a
TextBox, takes more than three minutes to load into a RichTextBox.
Even if I load the file with this code:

RichTextBox1.LoadFile(OpenFileDialog1.FileName, _
RichTextBoxStreamType.RichNoOleObjs)

Any idea for more speed?
 
Hi MSdousti,

You did ask the same question on 27 of January, did you try the advices or
are you only telling us that your solution does not work?

You where telling then that the stringbuilder did work on W'98 but did on
XP, however when we did ask for your code there was no Stringbuilder code
there and you said you had pasted it out because this was better but did
also not work.

There where some different advices,

Did you try those,

The only thing we see here is that you say that your solution should work or
that the Richtextbox is to slow and sentences in the same way.

We are also intrested in the results from an advice which has the trend to
do some examination.

Cor
 
Dear Cor
If u revisit that posting, u will see that I answered u about my
sourcecode but get no reply. That's why I started a new saying here. I
have tried all the ways u and the others offered me, but I got no
solution. The problem was not StringBuilders, forgot it please, for
the sake of God! The problem is TextBoxes implementation in windows
98. I tried another solutions like RichTextBoxes and understood that
they are too slow because they support a lot more than I need. I wish
that somebody helped me here.

Thnx for ur interest an advices.
Sincerely urs,
MSDousti
 
Hi MSDousti,

But did you test a combination of the answers.
Reading it in with stringwriter and than let that string go in one time to
the RichTextbox

And did you something to try on W9x in pseudo beneath

im mystring as new stringbuilder
dfor i as integer = 0 to 3300
mystring.add("abcdefghij")
next
mytextbox.text = mystring.tostring

and if an error what time would it take with this

myrichtextbox.text = mystring.tostring

That was the main reason that I did ask this question.

Cor
 
Back
Top