TrueOleDBGrid60.TDBGrid events. Vb6 vs vb.net

Posted by: juan.ome on 18 December 2019, 3:42 am EST

    • Post Options:
    • Link

    Posted 18 December 2019, 3:42 am EST

    Hello.

    We are migrating from vb6 to vb.net. In order to migration, we have some events with a little bit different. We are attaching a excel file with the questions about it.

    Thanks in advance

  • Posted 18 December 2019, 6:03 pm EST

    Hello,

    Sorry but we could not find any attachment.

    Kindly re attach the excel file.



    Note
    : If your file is greater than 5 mb then please upload the file on the given link :

    https://www.dropbox.com/request/EGxmjG928WJtrUk37MXF

    Regards,

    Prabhat Sharma.

  • Posted 19 December 2019, 1:19 am EST

    thankyou Prabhat,

    Done!, I have uploaded the file on the given link

    Thanks

  • Posted 19 December 2019, 6:28 pm EST

    Hello,

    We have updated the “Eventos TDBGrid revisar” sheet in your given excel file with the answers on the following link :

    https://www.dropbox.com/sh/sh0ku1get6aqkq0/AADcu8YQ4Rh5ea5eTBjn7Lnva?dl=0

    Regards,

    Prabhat Sharma.

  • Posted 20 January 2020, 1:29 am EST

    Thank yoy for your answereds, we are reviewing all the cases submitted.

    Now, it is too needy for us to have know about the error list of grid’s Error Event because there is in vb6 the DataError parameter that has the error number but it is different of vb.net; we are reviewing the e.exception object that contains the error information. We need both error lists, the vb.net grid’s error list and the vb6 one… or the link to get it.

  • Posted 20 January 2020, 11:01 pm EST

    Hello,

    As both the controls are from the different technology so they can be different in architecture.

    There is no property like DataError in vb.net’s TrueDBGrid.

    However you can try the below given code in the Error event to get the error code :

    catch (Exception e){  
        var w32ex = e as Win32Exception;
        if(w32ex == null) {
            w32ex = e.InnerException as Win32Exception;
        }    
        if(w32ex != null) {
            int code =  w32ex.ErrorCode;
        }    
    }
    

    Regards,

    Prabhat Sharma

  • Posted 21 January 2020, 12:41 am EST

    Thank Prabhat,

    The problem isn’t about the code is. Let me explain you, we are asking in the vb6’s code for a particular error number:

    example:

    Private Sub dbgrdAprobaciones_Error(ByVal DataError As Integer, Response As Integer)

    If DataError = 6156 Then

    MostrarMensaje 1621, LeerRecursoCadena(1621), vbOKOnly

    Response = 0

    End If

    Response = 0

    End Sub

    We are asking about the error number 6156, we need to know the vb.net’s number error that match… thats why we need the error list to compare and to do the match between both lenguajes.

    thanks in advance…

  • Posted 21 January 2020, 8:25 pm EST

    Hi,

    For vb6 error list, we have sent the request to the concerned team and will let you know once we get any updates on this.

    In vb.net the errors are general .NET exceptions and we don’t have any specific error list for this.

    Regards,

    Prabhat Sharma.

  • Posted 22 January 2020, 12:31 am EST

    thank you Prabhat,

    Your answers has been helpfull, I’ll be waitting for the vb6’s errors list.

    Thanks in advance…

  • Posted 23 January 2020, 6:03 pm EST

    Hello,

    We are happy to inform you that we have got the response from the concerned team. As per them : The Error event fires in a limited number of grid operations associated with databinding. A few of the errors reported are by TrueDBGrid, the rest are reported by the underlying database objects and the grid is merely reporting the errors.

    The grid operations include:

    • loading a layout file

      the grid reports “Layout file not specified”

      DataError = 6166

    • attempting to delete multiple rows with the delete key

      the grid reports “Cannot delete multiple rows”

      DataError = 6159

    • attempting to update a column during a change of cell event.

      the grid reports “Property is not available in this context”

      DataError = 6162

      This error sounds a bit cryptic, but it means you can only update a cell
      during specific cell change events.  Changing cell content during certain
      events is not allowed by the DataSource.
      
      You may also see this sort of error when requesting the ErrorText property
      outside of the Error event.  After the Error event is complete, the ErrorText
      property is no longer available.
      

    for OLEDB grid only

    • updating column data

      the grid reports “Data type mismatch during field update”

      DataError = 6156

    The above errors are detected and reported by the grid and are listed in the grid’s ErrorConstants enumerations. The best way to see all of the possible error reported by the grid itself, is to look at the ErrorConstants enumeration in the OCX viewer of the VB6 Object Viewer.

    All of the errors are actually the SCODE values of HRESULT values returned by the DataSource.

    The DataSource HRESULT values are actually = 0x80040000 + SCODE, where SCODE is a 16 bit value. I suggest making the addition in the Error event and displaying the value in HEX, then searching for the DAO and OLEDB related HEX values on the web.

    Regards,

    Prabhat Sharma.

  • Posted 24 January 2020, 3:35 am EST

    Thank you!! it’s wonderful news…

    Having this vb6’s errors list… it is possible to get the vb.net’s list that match to them?

    thanks in advance.

  • Posted 26 January 2020, 4:58 pm EST

    Hello Juan,

    Sorry but as I said earlier “In vb.net the errors are general .NET exceptions and we don’t have any specific error list for this.”

    If you need any other help, please let us know.

    Regards,

    Prabhat Sharma.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels