Apostrophe in a Function argument

Apostrophe in a Function argument

Anonymous
Not applicable
228 Views
2 Replies
Message 1 of 3

Apostrophe in a Function argument

Anonymous
Not applicable
I am writing a calculator that will work with feet and inches.
When I'm passing a figure followed by an apostrophe or a quotation mark (ex.
7' , or 4" ) to a function
I have a type mismatch message.
The function declaration is:

Public Function StringToNumber(strnum As string) As Double

and the line that is calling it is:
Dim n1 As Double
Dim strcbo1 As String
strcbo1 = cbo1.Text
n1 = StringToNumber(strcbo1)
What can I do to solve the problem?
I do not want to check in the calling sub if the last character in string is
' or ".
0 Likes
229 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
The AcadUtility class has conversion functions built into it. Take a
look at DistanceToReal.

--
http://www.acadx.com
Win a free autographed copy of
"AutoCAD 2000 VBA Programmer's Reference"
by Joe Sutphin

"Emil M" wrote in message
news:FD8C8710F92F3BB493A29B859373DD20@in.WebX.maYIadrTaRb...
> I am writing a calculator that will work with feet and inches.
> When I'm passing a figure followed by an apostrophe or a quotation
mark (ex.
> 7' , or 4" ) to a function
> I have a type mismatch message.
> The function declaration is:
>
> Public Function StringToNumber(strnum As string) As Double
>
> and the line that is calling it is:
> Dim n1 As Double
> Dim strcbo1 As String
> strcbo1 = cbo1.Text
> n1 = StringToNumber(strcbo1)
> What can I do to solve the problem?
> I do not want to check in the calling sub if the last character in
string is
> ' or ".
>
0 Likes
Message 3 of 3

Anonymous
Not applicable
tank's, that's what I need.
I checked the Autolisp and Automation comparison list from help
and there is no equivalent for distof.

"Frank Oquendo" wrote in message
news:4AB5FDAB350EF94C0B5444F5DC5C7A4A@in.WebX.maYIadrTaRb...
> The AcadUtility class has conversion functions built into it. Take a
> look at DistanceToReal.
>
> --
> http://www.acadx.com
> Win a free autographed copy of
> "AutoCAD 2000 VBA Programmer's Reference"
> by Joe Sutphin
>
> "Emil M" wrote in message
> news:FD8C8710F92F3BB493A29B859373DD20@in.WebX.maYIadrTaRb...
> > I am writing a calculator that will work with feet and inches.
> > When I'm passing a figure followed by an apostrophe or a quotation
> mark (ex.
> > 7' , or 4" ) to a function
> > I have a type mismatch message.
> > The function declaration is:
> >
> > Public Function StringToNumber(strnum As string) As Double
> >
> > and the line that is calling it is:
> > Dim n1 As Double
> > Dim strcbo1 As String
> > strcbo1 = cbo1.Text
> > n1 = StringToNumber(strcbo1)
> > What can I do to solve the problem?
> > I do not want to check in the calling sub if the last character in
> string is
> > ' or ".
> >
>
0 Likes