VB6 Print Problem
Hi, I am running VB6 and have a text box set to multi line and both scroll bars set. The problem I am having is that when I click on print to print the text box I end up with a copy of the text being place in the text box and then printing.
txtCm.SelStart = Len(txtCm) ' set the starting insertion point at the end of the text
txtCm.SelText = txtCm + vbCrLf ' add a string plus the carriage return
txtCm.SelStart = Len(txtCm) ' set the starting insertion point at the end of the text
txtCm.SelText = "" + vbCrLf ' add a string plus the carriage return
Found the problem with duplicate text being printed. I removed the txtCm from the second line of code and replaced it with "" marks. But now I have a problem with how to control the length of the line of text that is allowed to be entered in the text box.
The txtCm is the name of my txtbox. I would really appreciate the aid of you specialists in this matter. ~ Probie
[985 byte] By [
Probie] at [2007-11-11 10:07:40]

# 1 Re: VB6 Print Problem
your problem is here :
"txtCm.SelText = txtCm + vbCrLf "
before this line you are at the end of the text , this line append to the text a new version of it "txtCm" plus "vbCrlf" ... so u must not reput it again ..
really both of the two lines work individually , I mean u can use the first line only OR the second only , but the first line still need to append the vbcrlf .. and the second doesn't need to take the .seltext property :
txtCm.SelStart = len(txtCm)
txtCm.SelText = vbcrlf
or
txtCm = txtCm + vbcrlf
the difference here is in memory stress and the text largest capacity .
Amahdy at 2007-11-11 17:23:08 >

# 2 Re: VB6 Print Problem
Ah u have edited the post when I'm posting .. okey tell me u need to auto configure the maxlength when typing or before printing ?
the textbox can make this automatically if you set one only scrollbar "vertically" and with a proper textbox width , u can get what u want .. the problem only if u want the maxlength greater than your form width or the text font size change at runtime ...
Amahdy at 2007-11-11 17:24:10 >

# 3 Re: VB6 Print Problem
Okay Amahdy, I think you answered all my questions. Yes it is working just fine now, your coding and information have helped me a lot. Thank you very much ~ Probie
Probie at 2007-11-11 17:25:09 >
