Text box control - Migration problem VB 6.0 to VB.NET

vb.net Ukraine
  • 13 years ago

    Hello Everyone,

    Could anyone help to find an easy solution -

    For VB 6.0 application before the Form is closed i checked the DataChanged property of the TextBox controls and saved the changed data to Recordset and Updated DB.

    For VB.NET the DataChanged property of TextBox control does not exist any more.

    Could anyone advise a way to check the Text Box control changes before the Form is closed?

     Thanks.

    Regards,

    Holmes.vk 

  • 13 years ago

    I assume the text box is not in any way data-bound?

    If not, then a quick workaound is to perhaps use the tag property to determine a change.

    You might store 'changed' in the tag in the textchanged event, then look for any marked as such when the form closes.

    You might set the tag to be the same as the original text value, anc check for ones that are different when the form closes.

    (That has the advantage of avoiding false positives where a text box that started life as A, becomes B, then becomes A again. No actual change needed saving...)

     

    Anothe way of handling this is to have a form property called m_Dirty as a boolean.

    Set that to true if a change is made, and check it when the form closes, then save all fields ...

     

  • 13 years ago

    Thanks a lot for the ideas.

    Will try this out - i am just starting the migration and expects a lot of diffculties.

     regards,

    V.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” - Brian Kernighan