Home All Groups Group Topic Archive Search About

with...end with and the picturebox

Author
25 May 2005 1:28 PM
Lance
hi all,

why is it that using "with...end with" with the picturebox still requires you to follow
this syntax

With PictureBox
    .FillStyle = 1
    .DrawWidth = 2
    PictureBox.Circle (x, y), 500
    PictureBox.Line (x, y) - (x + 100, y + 100)
End With

instead of

With PictureBox
    .FillStyle = 1
    .DrawWidth = 2
    .Circle (x, y), 500
    .Line (x, y) - (x + 100, y + 100)
End With

lance

Author
25 May 2005 1:48 PM
Bob Butler
"Lance" <nu***@business.com> wrote in message
news:eRLsG2SYFHA.3572@TK2MSFTNGP12.phx.gbl
> hi all,
>
> why is it that using "with...end with" with the picturebox still
> requires you to follow this syntax
>
> With PictureBox
>     .FillStyle = 1
>     .DrawWidth = 2
>     PictureBox.Circle (x, y), 500
>     PictureBox.Line (x, y) - (x + 100, y + 100)

Because .Circle and .Line aren't really methods exposed by the picturebox
control's interface.  The VB compiler is intercepting those statements and
"pretending" that those methods existing by doing the appropriate graphics
work for you.  It would have been nice if that had been extended to the With
handling but whether it's an oversight or a bug or just something they did
not have time to do before release it's not there.

That the compiler supports these "methods" at all is a testament to the time
when the VB development team cared about people being able to move their
code forward to new versions with minimal trouble.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
25 May 2005 1:56 PM
Lance
ah, thanks.

lance

Show quoteHide quote
"Bob Butler" <tiredofit@nospam.com> wrote in message
news:O%23urvBTYFHA.1412@TK2MSFTNGP12.phx.gbl...
> "Lance" <nu***@business.com> wrote in message
> news:eRLsG2SYFHA.3572@TK2MSFTNGP12.phx.gbl
>> hi all,
>>
>> why is it that using "with...end with" with the picturebox still
>> requires you to follow this syntax
>>
>> With PictureBox
>>     .FillStyle = 1
>>     .DrawWidth = 2
>>     PictureBox.Circle (x, y), 500
>>     PictureBox.Line (x, y) - (x + 100, y + 100)
>
> Because .Circle and .Line aren't really methods exposed by the picturebox
> control's interface.  The VB compiler is intercepting those statements and
> "pretending" that those methods existing by doing the appropriate graphics
> work for you.  It would have been nice if that had been extended to the With
> handling but whether it's an oversight or a bug or just something they did
> not have time to do before release it's not there.
>
> That the compiler supports these "methods" at all is a testament to the time
> when the VB development team cared about people being able to move their
> code forward to new versions with minimal trouble.
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>