Re: Using a control as part of an exression
Steve Johnson <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <[email protected]> |
On 4/16/07, samir parekh <[email protected]> wrote: > > same in c# as well > > private void do_Something(Control c) > { > if(typeof(c) is ListBox) > { > > } > elseif(typeof(c) is -----any other type of framework compatible class) > { > > } > That won't work. The typeof operator yields a System.Type, which ListBox will never match. Do this instead: if(c is ListBox)... -- Steve Johnson