Masked Edit controls and disconnected recordsets


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Masked Edit controls and disconnected recordsets

  1. #1
    Chris Brown Guest

    Masked Edit controls and disconnected recordsets


    I have a form containing normal text box controls and masked edit controls.
    I have set the DATAFIELD property on the controls to the field name I am
    pulling back from an Oracle DB and then using a disconnected recordset to
    read the values from the DB and setting the DATASOURCE propty of the controls
    on the form to the recordset to populate them with the values thus:

    for each ctl in me
    if ctl.datafield<>"" then
    set ctl.datasource=rsDisconnected
    ctl.refresh
    endif
    next ctl

    and hey presto the correct values appear in the controls!!

    The problem lies when updating the values in the masked edit controls - it
    simply will not save the date value in the recordset field to which it is
    bound!!! (The text box controls work OK!). I have tested the type of data
    the masked edit control is returning using VARTYPE and it is returning a
    vbTEXT type. MSDN says that if the masked edit control is bound to an updatable
    recordset (which it is) then it will convert the string to the data type
    of the field - oh no it aint!!!

    It works fine when the masked edit controls are bound to an ADO data control
    but I'm not using that control because I want to return the data from my
    data tier DLL. Why does it work with the data control but not when you bind
    the controls 'on the fly'???

    Any help on this will be muchos appreciated

    Thanks in anticipation...



  2. #2
    Dennis Guest

    Re: Masked Edit controls and disconnected recordsets


    "Chris Brown" <christopherbrown@halifax.co.uk> wrote:
    >
    >I have a form containing normal text box controls and masked edit controls.
    >I have set the DATAFIELD property on the controls to the field name I am
    >pulling back from an Oracle DB and then using a disconnected recordset to
    >read the values from the DB and setting the DATASOURCE propty of the controls
    >on the form to the recordset to populate them with the values thus:
    >
    > for each ctl in me
    > if ctl.datafield<>"" then
    > set ctl.datasource=rsDisconnected
    > ctl.refresh
    > endif
    > next ctl
    >
    >and hey presto the correct values appear in the controls!!
    >
    >The problem lies when updating the values in the masked edit controls -

    it
    >simply will not save the date value in the recordset field to which it is
    >bound!!! (The text box controls work OK!). I have tested the type of data
    >the masked edit control is returning using VARTYPE and it is returning a
    >vbTEXT type. MSDN says that if the masked edit control is bound to an updatable
    >recordset (which it is) then it will convert the string to the data type
    >of the field - oh no it aint!!!
    >
    >It works fine when the masked edit controls are bound to an ADO data control
    >but I'm not using that control because I want to return the data from my
    >data tier DLL. Why does it work with the data control but not when you bind
    >the controls 'on the fly'???
    >
    >Any help on this will be muchos appreciated
    >
    >Thanks in anticipation...
    >
    >

    Using Masked Edit controls with dates has some inherent problems. See the
    Microsoft Knowledgebase article Q105766 - PRB: Invalid Property Value When
    Binding Masked Edit Control for more details. I've switched to the DateTimePicker
    control when I need dates to be entered.

    Dennis

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center