Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-10-28
2
Medium Priority
?
779 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

Accepted Solution

by:
it_saige earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

715 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