Thanks, everyone. It never happened to me in VB but at least I know I'm not
imagining things. There are other weird things going on but I'll save those for
another time.
Jim
--- In nsbasic-desktop@yahoogroups.com, "styskul" <epankoke@...> wrote:
>
> I actually used to have that problem in VB from time to time. I'd actually
have to copy the code from a module, create a new module, and paste the code
into that new module. This would happen even with modules that I hadn't touched
for some time. I think it must be a "feature" of Windows based development :)
>
> --- In nsbasic-desktop@yahoogroups.com, "cschuchert" <cschuchert@> wrote:
> >
> > George, Mark and Thomas,
> >
> > Thank you very much for your advice. The error message said "type mismatch
displayinverse" so I knew exactly where to look. Everything up to that line
within the code worked perfectly. I put a msgbox <variable name> at the
beginning of the code in the 'displayinverse' sub but it didn't get that far so
I am almost certain that for some reason, the program was not 'seeing' the sub.
'displayinverse' was not repeated anywhere in the code. That is what was so
mysterious about this issue. As I mentioned in an earlier post about the same
problem with another sub, when I deleted it from Module 1, created Module 2 and
placed it there, it worked. Now, all that being said, after reading your
replies this morning, but without changing anything except restoring things to
the way they were when it failed (see my original post) everything worked the
way it should. The call to the sub was valid. No code changes. Go figure.
Conclusion: a computer or OS problem or gremlins at work. Very strange but true.
If it had not happened to me, I would have been skeptical, too. If it happens
again, I will simply move the sub around by deleting, restoring, etc. until it
is ok.
> >
> > Jim
> >
> >
> >
> > --- In nsbasic-desktop@yahoogroups.com, "George Henne" <gh@> wrote:
> > >
> > > It's almost certainly something in your code. If MsgBox statement don't
> > > help you isolate the problem, try reducing your program to the shortest
> > > version that still has the problem. That will probably make things clear.
> > >
> > >
> > > >Something isn't right here and hope someone might have an insight into
> > > >what may be causing it. It could be a bug in NSB Desktop, itself, or
> > > >something I have done but my lack of expertise prevents my seeing it. I
> > > >reported a similar situation in this forum and the response was it must
> > > >be in the code and keep looking. Here is what is happening occasionally
> > > >but not always:
> > > >
> > > >I call a sub in a module from my code. When it gets to that code line,
> > > >it complains there is a type mismatch. I put a debugging msgbox at the
> > > >beginning of the sub and try again but it never gets that far, like it
> > > >doesn't think the sub is there. It stops at the code line and gives the
> > > >mismatch error. I realize that if the sub is not in the module, that
> > > >will happen but that isn't the case. The sub is there. A few days ago I
> > > >posed the question about "is there a limit to number of subs allowed in
> > > >a module" to which the reply was there is not. Nevertheless, I removed
> > > >the sub, created a new module and pasted it to the new one. It then
> > > >found the sub and all was ok. Now it happened again and my first
> > > >solution doesn't work. Consider this:
> > > >
> > > >Sub Displayinverse
> > > >If intAZ Then
> > > >strNS = ""
> > > >strEW = ""
> > > >End If
> > > >pintcntr = InStr(strFrpoint, "*")
> > > >plngPtfrom = Int(Mid(strFrpoint, 1, pintcntr - 1))
> > > >plngPtto = Int(Mid(strFrpoint, pintcntr + 1))
> > > >pstrBrng = strNS & strDeg & Chr(176) & strMin & Chr(39) & strSec &
> > > >Chr(34) & strEW
> > > >pstrDist = FormatNumber(dblDistance, sDecPl)
> > > >txtembedDisplay.Text = txtembeddisplay.Text & plngPtfrom & " " & _
> > > >pstrbrng & " " & pstrdist & vbCrLf
> > > >End Sub
> > > >
> > > >I placed this sub in Module 1 and tried to call it from the following
code:
> > > >Sub lenfrpoint1()
> > > > continueinverse
> > > > If intAZ Then dblBearingdms = dblBearing
> > > > If dblBearing = 90 Or dblBearing = 270 Then dblBearingdms = 90
> > > > converttodms
> > > > displayinverse `the one I was calling
> > > >End Sub
> > > >
> > > >It gave the `type mismatch' message
> > > >
> > > >I deleted it from Module 1 and put it in Module 2 with the same results.
> > > >
> > > >Then I copied the code within `displayinverse' and substituted if for
> > > >the sub, like this:
> > > >Sub lenfrpoint1()
> > > > continueinverse
> > > > If intAZ Then dblBearingdms = dblBearing
> > > > If dblBearing = 90 Or dblBearing = 270 Then dblBearingdms = 90
> > > > converttodms
> > > > If intAZ Then
> > > > strNS = ""
> > > > strEW = ""
> > > > End If
> > > >pintcntr = InStr(strFrpoint, "*")
> > > >plngPtfrom = Int(Mid(strFrpoint, 1, pintcntr - 1))
> > > >plngPtto = Int(Mid(strFrpoint, pintcntr + 1))
> > > >pstrBrng = strNS & strDeg & Chr(176) & strMin & Chr(39) & strSec &
> > > >Chr(34) & strEW
> > > >pstrDist = FormatNumber(dblDistance, sDecPl)
> > > >txtembedDisplay.Text = txtembeddisplay.Text & plngPtfrom & " " & _
> > > >pstrbrng & " " & pstrdist & vbCrLf
> > > >End Sub
> > > >
> > > >That works fine. Now what in the world could be causing the `type
> > > >mismatch' when calling the sub from the code? This sub (displayinverse)
> > > >is not many lines of code but I have others with a great number of lines
> > > >and don't want to paste them. Could it be the copying and pasting
> > > >operation from VB to NSB? I also have done the same thing from the CE
> > > >version and believe the first problem was from one those pastings. A
> > > >real conundrum!
> > > >
> > > >I am also finding that using the variant type may be causing problems
> > > >when comparing values. My if...then clauses using > and < in comparing
> > > >values gave me bad results because it apparently wasn't comparing
> > > >numbers with what it may have considered strings. As soon as I placed
> > > >`Int' in front of the value (which I thought the variant type recognized
> > > >as a double) it worked but not in all cases.
> > > >
> > > >I may kick myself when I discover how simple the problem presented
> > > >really is so I look forward to that kick. Thanks for reading through
> > > >this long post.
> > > >
> > > >Jim
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >------------------------------------
> > > >
> > > >Yahoo! Groups Links
> > > >
> > > >
> > > >
> > >
> >
>