Home All Groups Group Topic Archive Search About

ContainsFocus equivalent in VB

Author
31 Mar 2006 5:26 PM
Andy G
In the below snippet of code how can I write the line,   else if
(c.ContainsFocus) in vb?  Thanks.


  foreach (Control c in controls)
   {
      if (c.Focused)
      {
         // Return the focused control
         return c;
      }
      else if (c.ContainsFocus)
      {
         // If the focus is contained inside a control's children
         // return the child
         return getFocused(c.Controls);
      }
   }

Author
31 Mar 2006 6:09 PM
Chris
Andy G wrote:
Show quoteHide quote
> In the below snippet of code how can I write the line,   else if
> (c.ContainsFocus) in vb?  Thanks.
>
>
>   foreach (Control c in controls)
>    {
>       if (c.Focused)
>       {
>          // Return the focused control
>          return c;
>       }
>       else if (c.ContainsFocus)
>       {
>          // If the focus is contained inside a control's children
>          // return the child
>          return getFocused(c.Controls);
>       }
>    }
>
>
>


    for each c as Control in me.controls

        if c.Focused then

           'Return the focused control
           return c

        elseif c.ContainsFocus then

           'If the focus is contained inside a control's children
           'return the child
           return getFocused(c.Controls)
        end if
     next
Author
31 Mar 2006 7:00 PM
Andy G
c.ContainsFocus....I should've looked through intellisense.

Thanks Chris.

Show quoteHide quote
"Chris" <no@spam.com> wrote in message
news:eY51d5OVGHA.4884@TK2MSFTNGP10.phx.gbl...
> Andy G wrote:
>> In the below snippet of code how can I write the line,   else if
>> (c.ContainsFocus) in vb?  Thanks.
>>
>>
>>   foreach (Control c in controls)
>>    {
>>       if (c.Focused)
>>       {
>>          // Return the focused control
>>          return c;
>>       }
>>       else if (c.ContainsFocus)
>>       {
>>          // If the focus is contained inside a control's children
>>          // return the child
>>          return getFocused(c.Controls);
>>       }
>>    }
>>
>>
>>
>
>
>    for each c as Control in me.controls
>
>        if c.Focused then
>
>           'Return the focused control
>           return c
>
>        elseif c.ContainsFocus then
>
>           'If the focus is contained inside a control's children
>           'return the child
>           return getFocused(c.Controls)
>        end if
>     next
Author
1 Apr 2006 12:12 AM
Herfried K. Wagner [MVP]
"Andy G" <ajgould at iastate dot edu> schrieb:
> c.ContainsFocus....I should've looked through intellisense.

Sorry, but I cannot see any difference between 'c.ContainsFocus' in C# and
VB.NET...  Note that you are using the same API in both languages.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>