Prev: Graphic Draw Question
Next: Redirection
From: Dee Earley on 3 Mar 2010 05:56 On 02/03/2010 20:37, MM wrote: > Don't you think a ".Self" property would have been useful? Like Me. In the vast majority of cases, you already have a reference to be able to call .self on it :) This is the one (very rare) situation where you don't -- Dee Earley (dee.earley(a)icode.co.uk) i-Catcher Development Team iCode Systems
From: ralph on 3 Mar 2010 10:18 On Tue, 02 Mar 2010 16:48:41 -0800, Karl E. Peterson <karl(a)exmvps.org> wrote: >MM wrote: >> On Tue, 02 Mar 2010 12:45:12 -0800, Karl E. Peterson <karl(a)exmvps.org> >> wrote: >> >>> MM wrote: >>>>> AnyProc Controls(.Name) >>>> >>>> Ah, I tried everything else, but not that! >>> >>> Will that work with a control array member? >>> >>>> Don't you think a ".Self" property would have been useful? Like Me. >>> >>> I think This would have been a good way to refer to whatever With is >>> refering to. That way, it's not an extension of the object itself. >> >> Yeah, I like it! >> >> AnyProc .This >> >> That looks really cool. > >Ditch the leading dot. This would be like Me, but it would refer to >one of two things. Within a With block, to whatever object has >currency. Or, outside a With block, but within an Event procedure, to >the object that's raising the event. How's that sound? So, in your >case, you could do: > > With Combo1 > AnyProc This > End With > >Or, ... > > Private Sub Combo1_Change() > AnyProc This > End Sub > >Makes too much sense, I suppose. At least to me. I'm sure someone can >pick holes in it? The With...End construct is provided only to simplify typing, but having a simple reference to whatever object is being chewed on within a With...End block would have been nice. It is less of an issue with ... With Combo1 AnyProc Combo1 End With or even with ... With oJunk.Fields.Attributes AnyProc oJunk.Fields.Attributes End With as one can simply cut 'n paste whatever follows the "With". But if using this handy construct it is more of an issue... With New CJunk AnyProc <????> End With -ralph
From: Dave O. on 3 Mar 2010 10:54 "ralph" <nt_consulting64(a)yahoo.net> wrote in message news:btuso5pe1tgc404ekub232uh5qankce7qs(a)4ax.com... > The With...End construct is provided only to simplify typing, All together now: "Oh no it's not!" The With/End With only makes a single call to the COM, without the With there would be a call for every item that is replaced by the use of With/End With. There are some other subtle effects but they are not really important. Dave O.
From: Henning on 3 Mar 2010 11:02 "MM" <kylix_is(a)yahoo.co.uk> skrev i meddelandet news:h9iqo5pens21lrjljqfqpjgfi8at2p3ad2(a)4ax.com... > Suppose I have: > > Sub AnyProc (cbo as ComboBox) > MsgBox cbo.Name > End Sub > > With Combo1 > AnyProc ? > End With > > How can I refer to the object itself to pass to AnyProc? What I need > is a .Self property! > > MM Sorry, but I can't see why using With/End With to call AnyProc Combo1? Setting parameters is nice inside the With/End with, but the call should IMO be outside. With/End With has a certain functionality, we can't change that. ;) /Henning
From: MM on 3 Mar 2010 12:21
On Wed, 3 Mar 2010 15:54:06 -0000, "Dave O." <nobody(a)nowhere.com> wrote: > >"ralph" <nt_consulting64(a)yahoo.net> wrote in message >news:btuso5pe1tgc404ekub232uh5qankce7qs(a)4ax.com... > >> The With...End construct is provided only to simplify typing, > >All together now: "Oh no it's not!" > >The With/End With only makes a single call to the COM, without the With >there would be a call for every item that is replaced by the use of With/End >With. There are some other subtle effects but they are not really important. I've never actually noticed any improvement in performance, though, by using With/End With. I just think it makes the code more readable and looks neater. MM |