ContainsFocus equivalent in VB

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy G

    ContainsFocus equivalent in VB

    In the below snippet of code how can I write the line, else if
    (c.ContainsFocu s) in vb? Thanks.


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



  • Chris

    #2
    Re: ContainsFocus equivalent in VB

    Andy G wrote:[color=blue]
    > In the below snippet of code how can I write the line, else if
    > (c.ContainsFocu s) in vb? Thanks.
    >
    >
    > foreach (Control c in controls)
    > {
    > if (c.Focused)
    > {
    > // Return the focused control
    > return c;
    > }
    > else if (c.ContainsFocu s)
    > {
    > // If the focus is contained inside a control's children
    > // return the child
    > return getFocused(c.Co ntrols);
    > }
    > }
    >
    >
    >[/color]


    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.Co ntrols)
    end if
    next

    Comment

    • Andy G

      #3
      Re: ContainsFocus equivalent in VB

      c.ContainsFocus ....I should've looked through intellisense.

      Thanks Chris.

      "Chris" <no@spam.com> wrote in message
      news:eY51d5OVGH A.4884@TK2MSFTN GP10.phx.gbl...[color=blue]
      > Andy G wrote:[color=green]
      >> In the below snippet of code how can I write the line, else if
      >> (c.ContainsFocu s) in vb? Thanks.
      >>
      >>
      >> foreach (Control c in controls)
      >> {
      >> if (c.Focused)
      >> {
      >> // Return the focused control
      >> return c;
      >> }
      >> else if (c.ContainsFocu s)
      >> {
      >> // If the focus is contained inside a control's children
      >> // return the child
      >> return getFocused(c.Co ntrols);
      >> }
      >> }
      >>
      >>
      >>[/color]
      >
      >
      > 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.Co ntrols)
      > end if
      > next[/color]


      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: ContainsFocus equivalent in VB

        "Andy G" <ajgould at iastate dot edu> schrieb:[color=blue]
        > c.ContainsFocus ....I should've looked through intellisense.[/color]

        Sorry, but I cannot see any difference between 'c.ContainsFocu s' 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/>

        Comment

        Working...