Re: Newbie help please




"Rick Rothstein (MVP - VB)" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx> wrote in
message news:%23TGmKE8%23GHA.4320@xxxxxxxxxxxxxxxxxxxxxxx
Minor point Rick, but the above will produce a runtime error (13) if the
user doesn't enter anything.

I know... I mentioned as much in my last paragraph (the one following that
code snippet).


dblXinput = InputBox("Enter Lower Right X Coordinate") & 0#

will avoid the error.

The OP is a newbie, I didn't want to bog him down with those kind of
tricks... yet.<g>


Dim dblXinput As String
Do
dblXinput = InputBox("Enter Lower Right X Coordinate")
Loop While dblXinput = ""
lblxinput.Caption = CStr(dblXinput)


With the above the CStr() conversion is not necessary as dblXinput was
declared as a string. All is well of course until Wally attempts to
assign
to a double - which will then produce an error. Unless he provides a
conversion Dbl(dblXinput_str).

Bad editing on my part. The OP's initial code declared dblXinput as a
Double, so I used that initially. Then I went back and changed the
variable
to a String and missed the CStr function I had used. Thanks for noticing
it.


Which is just a boorish way to agree with you - there is always more to
even
the simplest task than often meets the eye.

Sort of the point I was making in the last paragraph of my previous post.


Rick


Plus the fact that sooner or later someone would have come in here and
suggested that the OP not use an InputBox, but create his own dialog. Then
we could go into the best means for 'returning' the value (public member,
event, Registry, ...), and the necessity of using a double for a coordinate
(wasting 8-bytes when 4 or 2 might do) which would lead to ...

With any luck, we could turn this whole thing into a 12-page dissertation.
<G>

-ralph


.


Loading