Discussion Locked

C#

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm a new c# student I've done Java and c++. We've been asked to
create a c# application that uses a picture a picture box. Given all the pictures
The tricky part is to get the picture box to show the different pictures based on a combo box control. On_click/ on_select of the comboBox Item, the pitures must be randomly selected, there's a button control that you can also use to transverse through the Items to be displayed on the picture Box, one picture Box. I know I have to use arrays for this to work but I'm a bit green when it comes to c#, so I'm not sure as to how to go about this

2 replies

by tony hopkinson

if you have a list of images in the combo box, then simply generate a random integer between 0 and comboxbox.items.count - 1.

in c# an array of string is defined with

string[] = new string[25] myimagefiles;

by 204138051

I got the first one, it was my first GUI in c#, I wasn't aware as to how they operate exactly in c#, but now I have some more insight now

another question
if you have an array of random numbers, how
would you make sure that the next number generated is not the same as the prevoius one and the ones already generated in the array

This discussion is closed to new replies.