Solved

Threading is not a member of windows... vb.net

Posted on 2014-10-28
2
716 Views
Last Modified: 2014-10-28
At line 22, I am getting two error notes:  

Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Input, DirectCast(Sub() element.Focus(),

Dispatcher: Dispacher is not declared. It may be inaccessible due to its protection level.
System.Windows.Threading: Threading is not a member of windows

Question: How can I fix this?

Please, in addition to description of the direction, give me the syntax for my use.


tabcontrol.IsSelected=true;
PutFocusOnControl(textBox1);
and define the method...

 private void PutFocusOnControl(Control element)
        {
            if (element != null)
                Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Input,
                    (System.Threading.ThreadStart)delegate
                    {
                        element.Focus();
                    });
        }

or:

                TabControl1.SelectedTab = tabChannels
                PutFocusOnControl(txtChannels_channel)

    Private Sub PutFocusOnControl(element As Control)
        If element IsNot Nothing Then
            Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Input, DirectCast(Sub() element.Focus(), System.Threading.ThreadStart))
        End If
    End Sub

from:
http://stackoverflow.com/questions/3865370/unable-to-set-focus-on-controls-inside-tab-control-in-wpf

Open in new window

0
Comment
Question by:Mike Eghtebas
2 Comments
 
LVL 33

Accepted Solution

by:
it_saige earned 500 total points
ID: 40409232
Have you added a reference to WindowBase.dll?

http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher(v=vs.110).aspx

To add the reference:
1.  Right-click on your project and select 'Add Reference'Capture.JPG2.  Select the .NET tab.Capture.JPG3.  Locate and select 'WindowsBase'Capture.JPG4.  Press 'OK'.

Once you have the reference added then you may need to refer to Dispatcher by it's fully qualified name, e.g. -
System.Windows.Threading.Dispatcher.BeginInvoke(...)

Open in new window

Or you can add an Imports statement to the top of your code file, e.g. -
Imports System.Windows.Threading

Public Class SomeClass
...
...
End Class

Open in new window


-saige-
0
 
LVL 34

Author Closing Comment

by:Mike Eghtebas
ID: 40409254
Thank you.
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question