Search the web
Sign In
New User? Sign Up
nsbasic-desktop · Forum for NS Basic/Desktop users
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
A mystery   Message List  
Reply | Forward Message #3088 of 3191 |
Re: A mystery

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
> > > >
> > > >
> > > >
> > >
> >
>





Sun Jul 12, 2009 10:57 pm

cschuchert
Offline Offline
Send Email Send Email

Forward
Message #3088 of 3191 |
Expand Messages Author Sort by Date

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...
cschuchert
Offline Send Email
Jul 11, 2009
8:50 pm

Hi Jim, you're not declaring any variables you use in your sub, so they should be global or the SUB won't work. I suggest you put "option explicit" right at...
computerhusky
Offline Send Email
Jul 11, 2009
10:23 pm

Thomas, Thank you for your reply. However, the variables are all declared as globals if you are talking about the first situation (type mismatch when calling a...
cschuchert
Offline Send Email
Jul 11, 2009
11:16 pm

Hi Jim, if you say you tried to put a msgbox statement inside your sub but it never gets that far, does that mean the call of the sub fails? If it gets a type...
Thomas Gruber
computerhusky
Offline Send Email
Jul 12, 2009
9:33 am

I'm with Thomas on this one. You didn't specify the line referenced in your error message, but based upon your description, it sounds as if the app is failing...
skysensor
Offline Send Email
Jul 12, 2009
1:16 pm

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...
George Henne
ghenne
Offline Send Email
Jul 12, 2009
10:42 am

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...
cschuchert
Offline Send Email
Jul 12, 2009
3:52 pm

Hi Jim, very mysterious, but I'm glad to hear that your program is working now. If something similar happens again, I'm sure someone in this group, including...
Thomas Gruber
computerhusky
Offline Send Email
Jul 12, 2009
4:27 pm

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...
Styskul
Offline Send Email
Jul 12, 2009
8:56 pm

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...
cschuchert
Offline Send Email
Jul 12, 2009
10:58 pm

NS Basic/Desktop's runtime is pretty solid. I'm sure there is a good explanation for the weird things you are seeing. Once they are isolated, we will help...
George Henne
ghenne
Offline Send Email
Jul 13, 2009
12:52 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help