Results 1 to 4 of 4

Thread: Block the copy pasting in textbox

  1. #1
    Join Date
    Nov 2009
    Posts
    1,035

    Block the copy pasting in textbox

    Hi there,

    I am having a small issue regarding the text box of my program developed in the Visual Basic 6. My problem is that i don't want to allow anybody to enter in my text box to make copying and pasting. But i don't know how to do that because i am a fresher. So any one with the solution an come forward to help me with the same. Waiting for the reply.

    A thanks may be appreciated.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Block the copy pasting in textbox

    Hi,

    If your are thinking about user trying to get into the SQL Statements into your in your program then it is better to move to the stored procedure. This is because when we give a value to the to a stored procedure it is known as the literal string so that it can not be executed. So make a change and see whether it is working or not.

    Thanks in advance.

  3. #3
    Join Date
    Jan 2008
    Posts
    3,388

    Re: Block the copy pasting in textbox

    Here is the code for the same so use it and try your luck. Say thanks if it works.

    Code:
    Private Sub txtPassw_KeyDown(KeyCode As Integer, Shift As Integer)
    If Shift = vbCtrlMask And (Chr(KeyCode) = "v" Or Chr(KeyCode) = "V") Then
    txtPassw.Locked = True
    Else
    txtPassw.Locked = False
    End If
    End Sub
    Private Sub txtPassw_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbRightButton Then
    txtPassw.Locked = True
    Else
    txtPassw.Locked = False
    End If
    End Sub

  4. #4
    Join Date
    May 2008
    Posts
    4,570

    Re: Block the copy pasting in textbox

    Try this also and see that it is working or not
    Code:
    Private Sub txtPassw_KeyDown(KeyCode As Integer, Shift As Integer)
        If Shift = vbCtrlMask And (Chr(KeyCode) = "v" Or Chr(KeyCode) = "V") Then
            txtPassw.Locked = True
        Else
            txtPassw.Locked = False
        End If
    End Sub
    
    
    Private Sub txtPassw_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = vbRightButton Then
            txtPassw.Locked = True
        Else
            txtPassw.Locked = False
        End If
    End Sub
    Source:microsoft.com

Similar Threads

  1. Replies: 4
    Last Post: 26-03-2012, 06:40 PM
  2. How to disable copy pasting or printing of images/texts from website?
    By Jaques Strapp in forum Technology & Internet
    Replies: 4
    Last Post: 20-01-2012, 01:31 PM
  3. Issue copy/pasting tasks between projects
    By Engreeks1 in forum Microsoft Project
    Replies: 1
    Last Post: 01-05-2011, 11:30 AM
  4. "Access Denied" for copy pasting on Windows Mobile
    By Delgado in forum Portable Devices
    Replies: 5
    Last Post: 10-06-2010, 02:46 AM
  5. Insufficient Privileges Error while Copy and Pasting Files
    By Dewei in forum Hardware Peripherals
    Replies: 6
    Last Post: 30-05-2010, 06:26 AM

Tags for this Thread

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
  •  
Page generated in 1,714,131,635.85066 seconds with 17 queries