473,387 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ThreadPriority

Hello group,
How can I specify the threadpriority in a string (comming from a configfile)
without using a structure like the following (To convert a string to a type,
you can use the activator, is that also the solution for my question) ?

Select Case strThreadPriority
Case "AboveNormal"
MyThrPrior = Threading.ThreadPriority.AboveNormal
Case "BelowNormal"
MyThrPrior = Threading.ThreadPriority.BelowNormal
Case "Highest"
MyThrPrior = Threading.ThreadPriority.Highest
Case "Lowest"
MyThrPrior = Threading.ThreadPriority.Lowest
Case "Normal"
MyThrPrior = Threading.ThreadPriority.Normal
End Select
Best regards,
Mobile boy
Feb 4 '08 #1
2 1193
"Mobileboy36" <Mo*********@gmail.comschrieb
Hello group,
How can I specify the threadpriority in a string (comming from a
configfile) without using a structure like the following (To convert
a string to a type, you can use the activator, is that also the
solution for my question) ?

Select Case strThreadPriority
Case "AboveNormal"
MyThrPrior = Threading.ThreadPriority.AboveNormal
Case "BelowNormal"
MyThrPrior = Threading.ThreadPriority.BelowNormal
Case "Highest"
MyThrPrior = Threading.ThreadPriority.Highest
Case "Lowest"
MyThrPrior = Threading.ThreadPriority.Lowest
Case "Normal"
MyThrPrior = Threading.ThreadPriority.Normal
End Select
Have a look at [Enum].Parse
Armin
Feb 4 '08 #2
"Mobileboy36" <Mo*********@gmail.comschrieb:
How can I specify the threadpriority in a string (comming from a
configfile) without using a structure like the following (To convert a
string to a type, you can use the activator, is that also the solution for
my question) ?

Select Case strThreadPriority
Case "AboveNormal"
MyThrPrior = Threading.ThreadPriority.AboveNormal
Case "BelowNormal"
MyThrPrior = Threading.ThreadPriority.BelowNormal
\\\
Imports System.Threading
....
Dim PriorityString As String = ...
Dim Priority As ThreadPriority = _
DirectCast( _
[Enum].Parse(GetType(ThreadPriority), PriorityString), _
ThreadPriority _
)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Feb 4 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mwazir | last post by:
Hi all, I have reposted this question from dotnet.general as I have been advised that this is a more appropriate forum for this question. Apologies for the repost. I have a process thats...
6
by: Christian Buckl | last post by:
Hi, I try to implement my own thread class based on POSIX threads. I want my class to manage everything (creation of threads, exception handling...). This includes also some functions that need to...
2
by: Martin Baker | last post by:
I have an activeX control which I am calling from a C# program, this works fine. I now want to call the activeX control from a seperate thread, this works but is very slow. This is far too slow...
4
by: Bhavya Shah | last post by:
Hello, I am facing a very strange problem in my application. I have a form on which I select a path. I open the FolderBrowserDialog for path selection. Once the path is selected I press a button...
4
by: Harry J. Smith | last post by:
How can a program change its execution priority in the operating system while it is running? -Harry
5
by: Mike | last post by:
Hi! I am trying to write a function that will span a thread for me. Eventually I want to incorporate this finction into a class: public void SpanThread(string threadName,string threadDelegate...
2
by: Steve Teeples | last post by:
I have a test application that will run multiple types of tests. Some are quite short (milli-seconds to seconds) and can run in parallel and others need to run serially - they take several minutes...
14
by: bill salkin | last post by:
The simple VB.NET loop: for i = 1 to 30000000 ' do something next drives the CPU on my computer to 100% utilization for the duration of the loop. (Several minutes) How can I modify this...
0
by: simplediscourse | last post by:
i'm trying to demonstrate timeslicing among equal high priority threads without putting threads to sleep. to do this i'm trying to run a timer while executing a very long loop sequence in order to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.