|
Random r = new Random((int) DateTime.Now.Ticks);<br />
yourValue = yourArray[r.Next(yourArray.Length - 1)];
Cheers,
Vikram.
The cold will freeze our stares
We won't care... Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
No but you can always post a thread here asking for one.
led mike
|
|
|
|
|
I want to get the element on a certain position in an ArrayList.
However, I didn't see any method for that.
I guess I can do it with a foreach and a counter, but this seems quite odd to me, as the ArrayList contains the method RemoveAt() which removes an element at a certain position.
What do you say?
|
|
|
|
|
It's just array indexing.
ArrayList ar = new ArrayList();
object o = ar[0]; // assuming you'd put something in there in between, of course.
If you're using .NET 2.0, never use ArrayList, use List instead, as it's typesafe.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: use List instead
Wouldn't you want to use List<> instead?
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
There is no non-generic List, AFAIK. If there is, yes, I meant to use the generic one.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Hello everyone!
OK, my program has to send me a single string once it is run on the user's computer.
For some strange reason my router isn't routing ports, so I can't make a program that sits there waiting for this string.
Maybe e-mail or another protocol I don't know of?
I wouldn't want the user's antivirus popping up with an error when sending the email, because then the user will think it's a virus and flame me out. Plus it's annoying, and I want my app to be 'smooth'.
I was thinking FTP, but then I'd have to put my username/password on the program and then they'll be able to see it by decompiling, and that's easy to do with C#.
What's the best option? Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
I was wondering if someone could point me in the right direction on this one. I need to write an app that can look at all the programs running on a pc, determine which ones are IE windows, and then read the contents of the loaded web page(s). I am familiar with scraping through web pages using the built in 2.0 browser, but this needs to be able to look over a regular browser window. Mostly, I am looking for the namespace to use to access another program with a c# app.
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Hi,
i have to develop a software that has to do some registration process, and after this all process, HAVE TO GENERATE A BARCODE FOR THAT.
Example
i give the following information,
Name: Neo
Eyes Color: Blue
Hair: Brown
so my barcode should be in the format neo-brownNeo-BlueNeo-brownBlue etc...
THIS IS JUST EXAMPLE.
is any one can help me in developing such a barcode or free library for sophisticated barcode generation and also reader for that.
if any one can help me, i shall be thankful to my friend.
Best Regards,
Neo
|
|
|
|
|
What do you expect to be able to read this barcode ? Do you want to invent a new barcode format, and if so, how do you expect to use it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
There are several barcode formats that support alpha characters. For instance code-39 barcode format supports characters. If you want to print code-39 barcode you need to get a font that will print it. Then you can just send the data to a label that is being displayed with the code-39 font. Then you will need to get a barcode scanner that can ready code-39.
Hope that helps.
Ben
|
|
|
|
|
I have used the IDAutomation .NET library for creating 2D matrix barcodes which can contain large amounts of alphanumeric data.
The website is here
|
|
|
|
|
I like your idea, please give me all related information to apply your idea.
how to write , how to read, what devices are needed for that , etc...
please answer me as soon as possible,
Best Regards,
Neo
|
|
|
|
|
|
Hello all,
I'm writing a windows service that has a few interesting requirements.
1) The service needs to communicate with a client application via remoting. The service can thus not have blocking operations running on its main thread, as that will keep the UI from being able to do what it needs to do.
2) The process that runs on the background thread will be long-running, and needs to use a specific known port. Therefore, only one background process can be occurring at any one time. Subsequent calls need to either queue or throw an error to the client.
3) I need an easy way to terminate the background process from the foreground one.
How would you guys recommend implementing this from a windows service? Is there an easy way to do it?
|
|
|
|
|
gantww wrote: How would you guys recommend implementing this from a windows service? Is there an easy way to do it?
There is a chapter on Remoting in Professional C# that will provide that exact solution for you.
led mike
|
|
|
|
|
Is that the yellow APress book? If so, I think I may be in luck, as my boss ordered it earlier this week.
|
|
|
|
|
|
Hi guys,
How can i make a bouncing ball program in C#. Lets say, upon a button clicked a ball is droped at the center of a 500 by 500 panel, once the ball/object knows that it has hit to the bottom how can I make the ball/object to move on till it hit to one of the four sided edge and keep going on.
Thanks
|
|
|
|
|
OK, your ball has to move, right ? So you store two variables in your program, they are how far your ball moves in the x and y directions. Then, you set a timer, every time it fires, you move and redraw your ball. When you move it, you check if you're hitting an edge. If you are, then you change the variables, so it bounces back, and changes direction in an appropriate way.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, I have the following code
myClass[] items = getItems();<br />
Type ty = typeof(myClass[]);<br />
<br />
IDataObject dobj = Clipboard.GetDataObject();<br />
dobj.SetData(ty, items);<br />
bool checkClipboard = dobj.GetDataPresent(ty);
Why does it return false if "items" is not null?
anybody with this problem before?
Thanks
|
|
|
|
|
Can someone help to design a cattle pen counting system to monitor the number of cows kept in a pen, (maximum 115). Pen has 2 gates (Exit & Entry). Consider the following processes:
Entry Gate
Exit Gate
Head Count
Need to Fill
Empty Pen
The system must be able to manage about 10 pens with data on each cow including: pen number, breed, weight, colour and gender.
|
|
|
|
|
Homework question? How do you think you should go about this? Make an attept, then come to us to help solve specific problems. You won't learn anything if we do your homework.
|
|
|
|
|
Perhaps he is in a business school and the asssignment is to manage developers working for him.
only two letters away from being an asset
|
|
|
|