when I run debug it doesn't throw errors

bones

Well-known member
Joined
Aug 23, 2014
Messages
143
Programming Experience
Beginner
I would first remove all code that sets a fixed value and configure that in designer instead :)


IsStartedFromZero property is type Boolean, while GetTypeCode return a TypeCode enumeration value. That won't compile if you have Option Strict On, which you should. It doesn't make anyway, because any boolean value will always return same type code.

When you turn on Option Strict you will have to cast type of SelectedItem, which is type Object, to correct type that is assigned, and that is type Color. Intellisense will offer to correct that for you automatically (in Error Correction Options).

Ok.... how come when I run debug it doesn't throw errors on either of those lines? .... Do I not have something configured correctly in Options?
 
Ok.... how come when I run debug it doesn't throw errors on either of those lines? ....
Because an implicit conversion is made from enum Integer value to Boolean.
Do I not have something configured correctly in Options?
In Compile tab in project properties set Option Strict to On.
 
Because an implicit conversion is made from enum Integer value to Boolean.

In Compile tab in project properties set Option Strict to On.

Ok...I just turned option strict on. Ran debug.... project built and there were no errors..... I expected to see an error thrown on that line....What am I missing here?

NOTE: I found those options under tools/options/vb defaults.... I have Explicit = on, Strict = On, Compare = binary, Infer = On

If I go to Project Properties / debug .... no such options are listed
 
Last edited:
NOTE: I found those options under tools/options/vb defaults.... I have Explicit = on, Strict = On, Compare = binary, Infer = On
That is not project property pages, that is Visual Studio options and controls defaults for new projects.

Project menu: "Name-of-project Properties...", or use context menu in Solution Explorer: project node > Properties.
 
That is not project property pages, that is Visual Studio options and controls defaults for new projects.

Project menu: "Name-of-project Properties...", or use context menu in Solution Explorer: project node > Properties.

Ahh.. I see now how that works....

Unfortunately, I now have 102 errors and even worst at the bottom of the error list it says "Maximum Number of Errors Exceeded"....
 
I know you'd prefer a new thread on this probably...but to keep things in context I'm going to post here and see what you suggest to do.

Have whittled down the errors to 19 remaining. Many are like this..

For some reason the site won't let me color code the error section.

the first r.cells(10).value is underlined in the editor... "Use Is Operator To Test Object Density" in the error list window...Intellisense offers nothing...

VB.NET:
Case Me.RBtnPort5.Checked
                    If r.Cells(10).Value = ("") Then
                        r.Cells(10).Value = Me.RBtnPort5.Text
                    End If
 
Thread split, discussion strayed vastly from the topic of the original thread.

Value property is type Object. In both cases you're comparing it to String type values, so convert Object to String first with CStr function. Type Conversion Functions (Visual Basic)
Then it will be ok to compare with = operator for equal string value. Is operator is for object equality, to see if two object references refer to the same object.
 
Back
Top