Results 1 to 6 of 6

Thread: Right-Click Copy and Paste making information disappear inside of MaskEdBox

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2022
    Posts
    3

    Right-Click Copy and Paste making information disappear inside of MaskEdBox

    I am currently maintaining a legacy program that uses VB6. One of its functionalities is to make a new account. In order to make a new account, certain information is necessary in order to generate the new account. This is usually an account number as well as a few other numbers that have certain uses for other stuff within our system. I recently had to change the text boxes used to get this information from the user from CtmEdit boxes to MaskEdBox boxes. This was to allow for copy and paste to work within them. While Ctrl+C and Ctrl+V works just fine in putting the information into the boxes, Right-Click Copy and Paste does not. It will put the information in the box but as soon as the focus is lost from the box where the Paste has happened, the box clears itself. This happens for every single box and seems to be something inherent to the MaskEdBox. I've tried switching every different attribute for the boxes and nothing seems to affect this. Has anyone else run into this issue and have any sort of suggestions on how to fix it?

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

    Re: Right-Click Copy and Paste making information disappear inside of MaskEdBox

    Can you save the pasted data as soon as it is entered, and then restore it when focus is lost?

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2022
    Posts
    3

    Re: Right-Click Copy and Paste making information disappear inside of MaskEdBox

    Quote Originally Posted by jdc2000 View Post
    Can you save the pasted data as soon as it is entered, and then restore it when focus is lost?
    I cannot. It's still saved to the clipboard but will disappear again if I right-click Paste into the text box. If I happen to add another character (we use numbers for our system), the information will stay. But if I just add a space, it disappears as soon as focus is lost.

  4. #4
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

    Re: Right-Click Copy and Paste making information disappear inside of MaskEdBox

    Does the Changed event for the MaskEdBox fire when you right-click and Paste the data? If it does, you should be able to capture the data from that and restore it.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2022
    Posts
    3

    Re: Right-Click Copy and Paste making information disappear inside of MaskEdBox

    It does fire but I'm not sure what logic I should use for right-click Pastes to the textboxes themselves.

  6. #6
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

    Re: Right-Click Copy and Paste making information disappear inside of MaskEdBox

    In the Changed event of the MaskEdBox, capture the data from the control to a variable. Then, you should be able to replace that data in the control on a LostFocus or Exit event for that control.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width