.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Getting a random number generator to be specific.

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :ASP.Net

Random rand = new Random((int)DateTime.Now.Ticks);
        int numIterations = 0;
        numIterations = rand.Next(1, 50);
        Response.Write(' ');
        numIterations = rand.Next(1, 50);
        Response.Write(' ');
        numIterations = rand.Next(1, 100);
        Response.Write(' ');
        numIterations = rand.Next(50, 100);
        Response.Write(' ');
        numIterations = rand.Next(50,100);
        Response.Write(' ');

View Complete Post

More Related Resource Links

how to use RSA or des,md5 TO make a random number generator?


how to use RSA or des,md5 TO make a random number generator?

how to use random generate number with linq

how to use random generate number with linqthanks in Advance:)

get random number less than x

hi how can i get a random number less than x. Best Regards. morteza

how to generate a unique random number on a form submission?


I want to generate a unique random number everytime a user submits a form. As the form is submited the data of the form should be placed in a database and a unique random number should be generated so that the user can later use this unique random number to reterieve his details from the database that refer to his unique random id. The unique random number should be atleast 9 digits long. Please help me on this.

VB - Random Number for Multiple Labels



Not sure if I'm approaching this correctly but this is what I've got and what I'm trying to do

I have a table with 10 Labels in it (Labels Id A1 thru A10)

I'm trying to have each label assigned a random number using 0-9

Need to have each labels number value different from the other

Code Below:


A1.Text = Int(Rnd() * 10)

A2.Text = Int(Rnd() * 10)

A3.Text = Int(Rnd() * 10)

A4.Text = Int(Rnd() * 10)

A5.Text = Int(Rnd() * 10)

A6.Text = Int(Rnd() * 10)

A7.Text = Int(Rnd() * 10)

A8.Text = Int(Rnd() * 10)

A9.Text = Int(Rnd() * 10)

A10.Text = Int(Rnd() * 10)

Thanks in Advance



How to generate a random number sequence that is non-repeating in visual basic .net ?


I am writing a matching program, and need 24 objects to randomly appear, each twice, across 48 spaces. I figured the best way for me to do this would be to assign the positions a number 1 through 48. but the problem is I can't find a way to generate a random number sequence in visual basic 9 .net

I found many examples in visual basic .net but the conversion doesn't work. If not some code, many some example programs that either use a random number sequence or randomly sets the position of objects.


Sketch Generator

Here is a site where you can generate a sketch of your image online.
An amazing site visit and enjoy this feature :)

Generate Random Numbers

SQL Server has a built-in function that generates a random number, the RAND() mathematical function. The RAND math function returns a random float value from 0 through 1.

Convert English to Arabic number without changing any regional settings in .net

Well, most applications that I worked with was multilingual that supports English UI and Arabic UI.

And one of the major issue that we have faced is displaying Arabic numbers without the need of changing the regional settings of the PC.

So the code below will help you to display Arabic number without changing any regional settings.

dynamically adding sql server columns based on number of files in fileuploader


I want to create a new table to sql database at runtime.  The column names would be "Name", "Date", "Event".  I would also like to have one more column name "Image" but the problem is that since the amount of images will vary, I want the application to count the amount of files in the Multiple fileuploader and then add a image column to the table for the respected amount of files. 

For example if i am uploading 3 files in the multiple fileuploader, the names should be "Name", "Date", "Event", "Image1", "image2", Image3"

I also would like that table name to be name dynamically from the textbox Name when the user enters the information.


I have the following code to make a new table, but I dont know how to name the fields at runtime like previously asked please help!!!


Dim objConn As New SqlConnection("Server=<servername>;uid=<userid>;pwd=<password>;database=master")


Embeb a variable number of videos


I need to provide some alternate content for my non-Flash users.

I have a directory of video files that is scanned using the DirectoryInfo() function, and I want to use the results to embed all files ending in ".mov" in QuickTime players on a web form.

How would you approach this? Right now I am using the count on the array of videos to determine how many times to repeat the embed code.  But this seems inelegant.

Is there a way to have a single QuickTime player.ascx control that gets duplicated according to the number of videos available for display?

Article commenting by line number


I'm wondering what's the best way to approach an online article system that allows users to comment by clicking on the line they are commenting about? Essentially the same way Adobe Acrobat works with comments where you can click anywhere and the text is saved for that location.

I'm assuming a mix of jQuery would be the crux of the interface. The system would need to save comments so that when another user logs in, they will also see the other comments but they can´t edit them - only add their own.

Any suggestions would be great.

Button specific code


I have 2 submit buttons on my page. Right now, the only way to run the code behind with razor is to to If(IsPost). Since I have 2 buttons, how would I destinguish between the two in post? Is there a way to request a button that sent a post request?  

The number of members in the conceptual type ... does not match with the number of members on the ob



I've added a scalar property to an entity and now ASP.NET Dynamic Data scaffolding throws this error:

The number of members in the conceptual type 'TrainingModel.Users' does not match with the number of members on the object side type 'TrainingModel.Users'. Make sure the number of members are the same.

This happens at the following line in global.asax:
model.RegisterContext(typeof(TrainingModel.TrainingEntities), new ContextConfiguration() { ScaffoldAllTables = true });

Please help!

huge number of data from database ... so how to minimize load time


Hi ...

I have used the above method to configure my crystal report ...

Its working fine , But i have huge number of data in database ....

So , it take long time to load the report ...

So , i have decided to show only the last 50 records inserted into the database , not all the 500 records to be loaded every time.

Plz help me with this issue  ...


Also , Plz explain me abt index legend in crystal report.

Stored procedure generator?


Hi, I am looking for a stored procedure generator with full source code(C#) compatible with Visual studio 2010. I want to create my custom stored procedure code. Please send some link. Regards, ap.

Getting list of users reporting from specific Manager from Active Directory


Dear All,

I am have requirement like displaying all the user information reporting to specific manager from Active Directory.

Please help me regarding this.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend