Re: Between Keyword
- From: "Bob Butler" <tiredofit@xxxxxxxxxxx>
- Date: Tue, 26 Dec 2006 07:46:45 -0800
"Haider Shah" <haider@xxxxxxxxxxxxxxxxx> wrote in message
news:u6qc4AQKHHA.448@xxxxxxxxxxxxxxxxxxxx
Hi i am using vb6, so any body inform me the following statment.
If (x >= Shape1.Left And _
x <= Shape1.Left + Shape1.Width And _
Between(y, Shape1.Top - 50, Shape1.Top + 50)) Or _
(y >= Shape1.Top And _
y <= Shape1.Top + Shape1.Height And _
Between(x, Shape1.Left - 50, Shape1.Left + 50)) Then
But the error that the "Between" keyword sub or function not defined.
is there "Between" keyword doesnt exist.
That's correct. VB has no 'Between' keyword. You can create your own
function if you want...
Public Function Between(ByVal TheVal As Single,ByVal LowVal As Single, _
ByVal HiVal As Single) As Boolean
Between=(TheVal>=LowVal And TheVal<=HiVal)
End Function
If (Between(x,Shape1.Left,Shape1.Left + Shape1.Width) _
And Between(y, Shape1.Top - 50, Shape1.Top + 50)) _
Or (Between(y,Shape1.Top,Shape1.Top + Shape1.Height) _
And Between(x, Shape1.Left - 50, Shape1.Left + 50)) Then
Or you can rewrite the original to test all the ranges directly
If (x >= Shape1.Left And x <= Shape1.Left + Shape1.Width _
And y>=Shape1.Top - 50 and y<=Shape1.Top + 50) _
Or (y >= Shape1.Top And y <= Shape1.Top + Shape1.Height _
And x>=Shape1.Left - 50 and x<=Shape1.Left + 50) Then
I'm not sure why you had one part of each test spelled out and the other
relying on there being a 'between' function.
--
Reply to the group so all can participate
VB.Net: "Fool me once..."
.
- References:
- Between Keyword
- From: Haider Shah
- Between Keyword
- Prev by Date: Between Keyword
- Next by Date: Re: Between Keyword
- Previous by thread: Between Keyword
- Next by thread: Re: Between Keyword
- Index(es):
Loading