home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / editbt / editdata.bas < prev    next >
Encoding:
BASIC Source File  |  1995-10-23  |  1.0 KB  |  29 lines

  1.  
  2. ' Copyright (c) 1994 by Barth Riley
  3.  
  4. Declare Function SendMessage Lib "user" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wp As Integer, lp As Any) As Long
  5.  
  6. Sub SetTBReadOnly (tbCtl As TextBox, ByVal fReadOnly As Integer)
  7.   '----------------------------------------------------------
  8.   ' Description:    Sets an edit control to read-only
  9.   '                 if fReadOnly is true, or to
  10.   '                 read/write when false.
  11.   ' Date Modified:  Jan 1st, 1994
  12.   ' Project:        Read-only Data Demo
  13.   ' Parameters:
  14.   '   tbCtl         (TextBox) edit control to set/reset
  15.   '   fReadOnly     (Flag) When true, sets tbCtl to
  16.   '                 read-only mode
  17.   ' Calls           SendMessage
  18.   '--------------------------------------------------------
  19.   '---Constant Declarations
  20.   Const WM_USER = &H400
  21.   Const EM_SETREADONLY = WM_USER + 31
  22.   '---DIM Variables
  23.   Dim intRet As Integer
  24.   '---CODE Begins
  25.   intRet = SendMessage(tbCtl.hWnd, EM_SETREADONLY, fReadOnly, 0&)
  26.   '---SetTBReadOnly ends
  27. End Sub
  28.  
  29.