Member Avatar for Chris11246

Im new to C# and Im trying to call one class from another but I cant figure out how.

Also Im trying to use a random number so that if it is greater then a number it will call the class but i cant seem to use the number

Recommended Answers

All 3 Replies

hi chris11246
u want to call class

Secondclassname obj=new Secondclassname()

inside function if u want to call means

obj.functionname()

I advice you wrote initalization of random number out of class it helps not repeats same numbers (little bit)

static Random rand = new Random();

in that way you declare it


and use it in program
some_variable = rand.Next(1, 46);
it will give you randomalic numberbetween 1 to 46 not included

Well done, you'll find further examples of random in the helpfile

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.