Solved

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

Posted on 2014-10-28
2
676 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 32

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 33

Author Closing Comment

by:Mike Eghtebas
ID: 40409254
Thank you.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Tabcontrol Caption? 1 24
Long URL in SMS 6 24
Different Delete Messages 7 17
Open a word document 23 13
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now