Why is the compiler arguing with me?


I do not understand why the compiler is showing me this error:

oSQL.AddValues conMemInfo.txtSectionA.text.Val, conMemInfo.txtSectionB.text.Val, Session.gnPersonID

The container conMeminfo contains the text field txtSectionA as well as txtSectionB

The compiler says conMemInfo.txtSectionA Doesn’t exist, But it does???

If I place the curser after conMemInfo. and hit the tab key I see it listed.

I just don’t get it!

Using 2015 R2.4 on Mac


When I ran into errors of this kind, it was usually because I tried to add the class, not an instance of it. Could it be anything like that?

Please don’t make such long statements.
It is hard to debug and often hides potential problems.
Maybe it becomes clear when you use some variables.

@Ulrich Bogun

It is only flagging the first one, not the second. They are the same, aren’t they?

Well, if the compiler says something does not exist, it is probably true. You should follow Christian’s advise. It doesn’t have to be as extreme as the following:

[code]Dim memInfo As ContainerControl = conMemInfo
Dim sectionA As TextField = txtSectionA
Dim sectionB As TextField = txtSectionB

Dim value1 As Double = sectionA.Text.Val
Dim value2 As Double = sectionB.Text.Val
Dim personID As String = Session.gnPersonID

oSQL.AddValues(value1, value2, personID)[/code]

@Ulrich Bogun

That was it, trying to access the Class. I think it has todo with my naming conventions!


You don’t know how often I encountered that “bug” – always puzzled for a few minutes before I start to remember how I “fixed” it earlier :smiley:

Naming instances such that they are distinguishable from the classes they are based on is a good thing

C and I is one I’ve seen long ago although that then makes one wonder how you name an interface

I know I’ve seen Class, Intfc, I plus various names for private properties, public protected etc

I’m sure this could lead to a long discussion of naming conventions

Hopefully. I think a discussion about naming conventions could even top the 3615 posts of the “Pet peeves” thread…

Naming conventions are a matter of personal preference in so many ways there’s no “right” or “wrong”.
I’ve seen long tomes written about “how to” and the discussions that ensues often disagree about niggly bits.

Use what works best for you and your team - regardless of size.

I can say that the IDE code base has a range of techniques that have been used because it’s the accumulation of 10+ years of different developers with different philosophies. Trying to standardize it would be nice but then you guys would have to put up with no fixes etc in the IDE for many months while I did that - so its very unlikely to happen.

I know @Bob Keeney’s team has some - certainly ones for the DB end of projects http://www.bkeeneybriefs.com/2014/08/naming-conventions-2/
I suspect @Jeremy Cowgar has some
No idea about anyone else

I think small nations have gone to war over naming conventions. :slight_smile:

Use what works for you and be consistent. That’s the real trick (and power of) naming conventions.