473,403 Members | 2,359 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,403 software developers and data experts.

Random ENUM?

Hey all!

Just wondering if there is an easy way to generate a random ENUM?

For example...

txtInput.Dock = DockStyle.RandomStyleHere

....how would I write this in VB.Net code to tell the textbox to dock with a
random side (or fill, or none)?
Nov 20 '05 #1
3 2407
I'm not going to write if for you but, yes check out the Random.Next(
Int32 ) member function of the random class. This will get you where you
need to be.

Regards - OHM
Grahmmer wrote:
Hey all!

Just wondering if there is an easy way to generate a random ENUM?

For example...

txtInput.Dock = DockStyle.RandomStyleHere

...how would I write this in VB.Net code to tell the textbox to dock
with a random side (or fill, or none)?

Nov 20 '05 #2
"Grahmmer" <po********@127.0.0.1> schrieb
Hey all!

Just wondering if there is an easy way to generate a random ENUM?

For example...

txtInput.Dock = DockStyle.RandomStyleHere

...how would I write this in VB.Net code to tell the textbox to dock
with a random side (or fill, or none)?


Add the styles to an array and use Rnd (Microsoft.VisualBasic.VBMath.Rnd) or
System.Random to create a random index. Then use the index to select the
style in the array.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Good enough for me!

"One Handed Man" <Bo****@Duck.net> wrote in message
news:bp**********@sparta.btinternet.com...
I'm not going to write if for you but, yes check out the Random.Next(
Int32 ) member function of the random class. This will get you where you
need to be.

txtInput.Dock = DockStyle.RandomStyleHere

Nov 20 '05 #4

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

Similar topics

1
by: herbert | last post by:
How can I get the minimum value, maximum value, the number of items in an enum and a random value from an enum? I intend to use an enum as a lookup table for randomly selected colours. Or is enum...
3
by: BlueOysterCult | last post by:
Hello I am having dificulty with this homework question ( I know its homework but I have been trying for a while with this) "generate 50 random numbers between 0 and 6 and count the number of...
38
by: One Handed Man \( OHM - Terry Burns \) | last post by:
I have a basic question thats been niggling me, but I never found time to look at it before. If I have an enumeration such as this Fiend Enum TravelDirection North South East
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: 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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.