Click here to Skip to main content
15,895,799 members
Home / Discussions / C#
   

C#

 
Generalvoice Pin
heba_zien27-Dec-03 10:06
heba_zien27-Dec-03 10:06 
GeneralRe: voice Pin
Wizard_0127-Dec-03 10:36
Wizard_0127-Dec-03 10:36 
GeneralRe: voice Pin
Nick Parker27-Dec-03 10:38
protectorNick Parker27-Dec-03 10:38 
GeneralProblem adding web reference to Visual c++ application Pin
Anonymous27-Dec-03 9:56
Anonymous27-Dec-03 9:56 
GeneralConditional Xml Document Reading Pin
LokiSD27-Dec-03 6:04
LokiSD27-Dec-03 6:04 
GeneralRe: Conditional Xml Document Reading Pin
Nick Parker27-Dec-03 8:14
protectorNick Parker27-Dec-03 8:14 
Generalread jpeg into memory Pin
Leon Radley27-Dec-03 5:30
Leon Radley27-Dec-03 5:30 
GeneralRe: read jpeg into memory Pin
Nick Parker27-Dec-03 8:33
protectorNick Parker27-Dec-03 8:33 
Leon, something like this should work:

Random r = new Random();
int imageCount = r.Next();

Image[] images = new Image[imageCount];

// You will need to get the CD-ROM drive letter...
string[] files = Directory.GetFiles("D:\", "*.jpg");

for(int i = 0; i < imageCount; i++)
    images[i] = Image.FromFile(files[i]);


A couple of thoughts though, you should clean this up, I just typed it from my head. You will want to do validation to confirm you have files by checking the length of the array and checking for null, you may also want to limit the size of the number of images you want to get where I am just generating a random number. Don't forget to check and make sure that you have enough images on the CD in relation to the random number of images you are going to display. Hope this is of some help.

[EDIT]
You may also want to make your selection of the images from the collection of images you return from Directory.GetFiles(...) more random instead of just iterating throuh the list of files. Your call, this is just the basic idea.
[/EDIT]



- Nick Parker
  My Blog

GeneralRe: read jpeg into memory Pin
Wizard_0127-Dec-03 8:40
Wizard_0127-Dec-03 8:40 
GeneralRe: read jpeg into memory Pin
Nick Parker27-Dec-03 8:54
protectorNick Parker27-Dec-03 8:54 
GeneralRe: read jpeg into memory Pin
Leon Radley29-Dec-03 1:49
Leon Radley29-Dec-03 1:49 
GeneralADS Pin
realaravind27-Dec-03 2:59
realaravind27-Dec-03 2:59 
GeneralRe: ADS Pin
Wizard_0127-Dec-03 3:12
Wizard_0127-Dec-03 3:12 
QuestionHow to create menuItems dynamic on Popup event? Pin
Chris Richner27-Dec-03 2:02
Chris Richner27-Dec-03 2:02 
AnswerRe: How to create menuItems dynamic on Popup event? Pin
Wizard_0127-Dec-03 3:05
Wizard_0127-Dec-03 3:05 
GeneralRe: How to create menuItems dynamic on Popup event? Pin
Chris Richner27-Dec-03 3:29
Chris Richner27-Dec-03 3:29 
GeneralRe: How to create menuItems dynamic on Popup event? Pin
Heath Stewart27-Dec-03 5:29
protectorHeath Stewart27-Dec-03 5:29 
GeneralRe: How to create menuItems dynamic on Popup event? - what I did with a couple of classes Pin
Bryan White1-Jan-04 22:20
Bryan White1-Jan-04 22:20 
GeneralC# and COM - Further information Pin
Tristan Rhodes27-Dec-03 1:17
Tristan Rhodes27-Dec-03 1:17 
GeneralRe: C# and COM - Further information Pin
Nick Parker27-Dec-03 4:30
protectorNick Parker27-Dec-03 4:30 
GeneralRe: C# and COM - Further information Pin
27-Dec-03 5:15
suss27-Dec-03 5:15 
GeneralRe: C# and COM - Further information Pin
Heath Stewart27-Dec-03 5:26
protectorHeath Stewart27-Dec-03 5:26 
QuestionHow can I make a newline in &quot;net send&quot; Pin
bookwormXP26-Dec-03 19:50
bookwormXP26-Dec-03 19:50 
AnswerRe: How can I make a newline in &quot;net send&quot; Pin
leppie27-Dec-03 0:39
leppie27-Dec-03 0:39 
GeneralRe: How can I make a newline in &quot;net send&quot; Pin
bookwormXP27-Dec-03 1:01
bookwormXP27-Dec-03 1:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.