DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2007
    Location
    Canada
    Posts
    16

    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.

    Code:
    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
    Code:
    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
    Last edited by Probie; 01-05-2007 at 02:49 PM.

  2. #2
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    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 :
    Code:
    txtCm.SelStart = len(txtCm)
    txtCm.SelText = vbcrlf
    or
    Code:
    txtCm = txtCm + vbcrlf
    the difference here is in memory stress and the text largest capacity .
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  3. #3
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    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 ...
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  4. #4
    Join Date
    Jan 2007
    Location
    Canada
    Posts
    16
    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
    Last edited by Probie; 01-05-2007 at 03:39 PM. Reason: typo

Similar Threads

  1. Outlook Problem in VB6
    By Spumbu1977 in forum VB Classic
    Replies: 4
    Last Post: 03-28-2006, 02:51 PM
  2. Print Left Margin In Vb6
    By Urbaud in forum VB Classic
    Replies: 1
    Last Post: 01-01-2006, 07:43 PM
  3. Reliability Problem
    By elise in forum Java
    Replies: 0
    Last Post: 10-30-2002, 04:40 AM
  4. Problem updating database w/two tables in VB6
    By Jade29 in forum VB Classic
    Replies: 3
    Last Post: 01-12-2002, 10:12 PM
  5. VB6 ADO DataGrid cell edit problem
    By Brenton Norman in forum VB Classic
    Replies: 0
    Last Post: 04-10-2001, 01:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links