CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 1999
    Location
    MA
    Posts
    6

    Masked Edit Box Problem

    Hi,
    I am having problems using the MaskEdBox.

    I'm using VB 6.0 and MSMASK32.OCX. with an
    ADO data control connected to a SQL Server 7 database, running on WinNT 4.0 workstation.

    The computer's "Regional Settings" for the date are MM/dd/yyyy.

    The MaskEdBox (mskBirthday) is bound to a field
    "Birthday" (datatype=datetime, length=8).

    The mask is: ##/##/##
    The DataFormat Property is: Date - Format$ MM/dd/yy

    Two problems are actually occuring:
    1. Editing - after making a change to a date and trying to invoke the recordset.update method, I get the error: "The change was cancelled during notification; no columns are changed". I am unable to edit a date.
    ?? is that a SQL Server error ??

    2. Adding a new record (AddNew method) - and then trying to invoke the recordset.update method, the error message is simply: "Errors Occured", and the record does not get added to the table. I know the problem is caused by the MaskedEdBox control, because if I use a regular textbox everything works fine.

    I am new to this MaskEdBox... so any help will be greatly appreciated.


  2. #2
    Join Date
    Apr 1999
    Location
    Brooklyn, NY USA
    Posts
    171

    Re: Masked Edit Box Problem

    I had some problems with Mask Edit. It did not clear when record did not contain any data in a field bound to that box. Maybe it will help you somehow. I solved it this way - in reposition event of DC I wrote:

    With MaskEdPhone
    .Refresh
    If IsNull(datAccount.Recordset("[Account Phone]")) = true then
    .Mask = "" 'delete mask, because text property will not be cleared without this
    .Text = ""
    .Mask = "(###) ###-####" 'restore mask
    else
    .Mask = "(###) ###-####"
    End If
    End With



    Vlad Chapranov


  3. #3
    Join Date
    Apr 2001
    Posts
    4

    Re: Masked Edit Box Problem

    You might want to check your properties for the masked edit control to ensure that the PromptInclude property is set to TRUE. The reason for this is the mask you are using "##/##/##" contains the literal characters "/" which are either included or excluded from the control's .Text value based on the setting of this property. If the property is set to FALSE the slashes will not be included and the actual .Text value will result in mmddyy instead of mm/dd/yy, which will generate an error when you try to update a bound date field.


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

Featured