Err.Number (VB6 vs C #)

I used the Artinsoft VB6 for .NET wizard to convert a VB6 application to C #, and I get an update warning anywhere I used Err.Number before;

// UPGRADE_WARNING: (2081) Err.Number has a new behavior.

The converted code refers to:

Microsoft.VisualBasic.Information.Err().Number

I’m not lucky to know what the difference is. Does anyone know what this might be, or is it possible to ignore this warning?

UPDATE

For those who stumble upon this question in the future - a word of warning; It is not recommended that you continue to use Err.Number in a C # .NET application. The property is still available, but it does not populate after errors as expected. The only time it is populated is expected to be an error that occurs from the COM component.

Normal errors, for example. DB access, I / O, etc. Will not assign the value Err (). Number, and therefore its use should be reorganized, unfortunately.

Oddly enough, in VB.NET it still works as expected, so maybe you need to keep this in mind when deciding on the target language to convert.

+5
source share
3 answers

Basically, VB.NET supports the Err.Number property, and it works almost the same as in VB6, however, when upgrading to C # Microsoft.VisualBasic.Information.Err (). The number is not filled out correctly and you should not rely on it.

, , - COM-, InnerException .

Err.Number .NET , .

+2

VB6 Err.Number 2000 . MSDN:

Returns or sets a numeric value specifying an error. Number is the Err object default property. Read/write.

VB.NET Err.Number MSDN:

Returns or sets a numeric value specifying an error. Read/write.

MSDN Oct 2000 - VB.NET, . , .

+1

Perhaps the changed numbers have changed?

0
source

All Articles