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   Topic List   < Prev Topic  |  Next Topic >
Summarize Messages Sort by Date  
#3079 From: "cschuchert" <cschuchert@...>
Date: Sat Jul 11, 2009 8:49 pm
Subject: A mystery
cschuchert
Offline Offline
Send Email Send Email
 
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






#3080 From: Computerhusky <computerhusky@...>
Date: Sat Jul 11, 2009 10:22 pm
Subject: Re: A mystery
computerhusky
Offline Offline
Send Email Send Email
 
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 the beginning of your program and DIM all variables.
Remember that all variables are local and are known only inside the sub or function where they are declared (dim) or assigned a value!  
Kind regards
Thomas
Von meinem iPhone gesendet

Am 11.07.2009 um 22:49 schrieb "cschuchert" <cschuchert@...>:

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



#3081 From: "cschuchert" <cschuchert@...>
Date: Sat Jul 11, 2009 11:15 pm
Subject: Re: A mystery
cschuchert
Offline Offline
Send Email Send Email
 
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 sub).
Because my subs usually call other subs, I use a lot of global variables.
Apparently that is not the problem.

Jim


--- In nsbasic-desktop@yahoogroups.com, Computerhusky <computerhusky@...> wrote:
>
> 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 the
beginning of your program and DIM all variables.
> Remember that all variables are local and are known only inside the sub or
function where they are declared (dim) or assigned a value!
> Kind regards
> Thomas
> Von meinem iPhone gesendet
>
> Am 11.07.2009 um 22:49 schrieb "cschuchert" <cschuchert@...>:
>
>
>
> 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
>





#3082 From: Thomas Gruber <computerhusky@...>
Date: Sun Jul 12, 2009 9:33 am
Subject: Re: Re: A mystery
computerhusky
Offline Offline
Send Email Send Email
 
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 mismatch caused by the call itself, not something inside the sub, that sounds to me as if there is another sub (or function) with the same name (displayinverse) somewhere in your code. Or possibly a variable with this name?
Kind regards
Thomas

Am 12.07.2009 um 01:15AM schrieb cschuchert:



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 sub). Because my subs usually call other subs, I use a lot of global variables. Apparently that is not the problem.

Jim

--- In nsbasic-desktop@yahoogroups.com, Computerhusky <computerhusky@...> wrote:
>
> 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 the beginning of your program and DIM all variables.
> Remember that all variables are local and are known only inside the sub or function where they are declared (dim) or assigned a value! 
> Kind regards
> Thomas
> Von meinem iPhone gesendet
> 
> Am 11.07.2009 um 22:49 schrieb "cschuchert" <cschuchert@...>:
> 
> 
> 
> 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
>



#3084 From: "skysensor" <skysensor@...>
Date: Sun Jul 12, 2009 1:16 pm
Subject: Re: A mystery
skysensor
Offline Offline
Send Email Send Email
 
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 before reaching the sub.

Take a look at the variable and sub names in the line referenced in your error
message, and search for them in your code (using the ctrl-F function). Review
each instance, looking for unintentional use or duplication.

Good luck. Mark


--- In nsbasic-desktop@yahoogroups.com, Thomas Gruber <computerhusky@...> wrote:
>
> 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 mismatch caused by the call itself, not something inside
> the sub, that sounds to me as if there is another sub (or function)
> with the same name (displayinverse) somewhere in your code. Or
> possibly a variable with this name?
> Kind regards
> Thomas
>
> Am 12.07.2009 um 01:15AM schrieb cschuchert:
>
> >
> >
> > 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 sub). Because my subs usually call other subs, I use
> > a lot of global variables. Apparently that is not the problem.
> >
> > Jim
> >
> > --- In nsbasic-desktop@yahoogroups.com, Computerhusky
> > <computerhusky@> wrote:
> > >
> > > 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 the beginning of your program and DIM all
> > variables.
> > > Remember that all variables are local and are known only inside
> > the sub or function where they are declared (dim) or assigned a value!
> > > Kind regards
> > > Thomas
> > > Von meinem iPhone gesendet
> > >
> > > Am 11.07.2009 um 22:49 schrieb "cschuchert" <cschuchert@>:
> > >
> > >
> > >
> > > 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
> > >
> >
> >
> >
>





#3083 From: "George Henne" <gh@...>
Date: Sun Jul 12, 2009 10:41 am
Subject: Re: A mystery
ghenne
Offline Offline
Send Email Send Email
 
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
>
>
>




#3085 From: "cschuchert" <cschuchert@...>
Date: Sun Jul 12, 2009 3:51 pm
Subject: Re: A mystery
cschuchert
Offline Offline
Send Email Send Email
 
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
> >
> >
> >
>





#3086 From: Thomas Gruber <computerhusky@...>
Date: Sun Jul 12, 2009 4:26 pm
Subject: Re: Re: A mystery
computerhusky
Offline Offline
Send Email Send Email
 
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 myself, will be willing to look at the code (if you're prepared to share it and it is nothing confidential of course. Sometimes an outsider sees something that the developer doesn't, at least that's my experience.
Just 1 more hint: try to make the msgbox statements as simple as possible ( like   msgbox "start of sub displayinverse" ) and not to use any variables, as the variable itself may cause an error, too. For mysteries like this I tend to use fixed strings in quotes only, until I know where the program is going.

But I must admit some debugging support by NSBasic itself would be more than welcome, e.g. a call stack of subs/functions and/or a list of variables used and their current types and values in case of an error. But I doubt that's possible with the VBScript engine.
Kind regards
Thomas

Am 12.07.2009 um 17:51PM schrieb cschuchert:



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



#3087 From: "styskul" <epankoke@...>
Date: Sun Jul 12, 2009 8:55 pm
Subject: Re: A mystery
Styskul
Offline Offline
Send Email Send Email
 
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
> > >
> > >
> > >
> >
>





#3088 From: "cschuchert" <cschuchert@...>
Date: Sun Jul 12, 2009 10:57 pm
Subject: Re: A mystery
cschuchert
Offline Offline
Send Email Send Email
 
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
> > > >
> > > >
> > > >
> > >
> >
>





#3090 From: "George Henne" <gh@...>
Date: Mon Jul 13, 2009 12:51 pm
Subject: Re: Re: A mystery
ghenne
Offline Offline
Send Email Send Email
 
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 explain if it still isn't clear.

>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
>> > > >
>> > > >
>> > > >
>> > >
>> >
>>
>
>
>
>
>------------------------------------
>
>Yahoo! Groups Links
>
>
>




 
Advanced
Add to My Yahoo!      XML What's This?

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