I never realized creating a dynamic-linked-library could be this easy or this much fun.
using System;
using System.ComponentModel;
using System.Collections;
using System.Diagnostics;
namespace StepByStep7_1
{
/// <summary>
/// Summary description for RandomNumber.
/// </summary>
public class RandomNumber : System.ComponentModel.Component
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public RandomNumber(System.ComponentModel.IContainer container)
{
///
/// Required for Windows.Forms Class Composition Designer support
///
container.Add(this);
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
public RandomNumber()
{
///
/// Required for Windows.Forms Class Composition Designer support
///
InitializeComponent();
minValue=100;
maxValue=1000;
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
minValue=0;
maxValue=0;
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
/// <summary>
/// Store the minimum value for random number
/// </summary>
public int minValue;
/// <summary>
/// Store the max value for random number
/// </summary>
public int maxValue;
/// <summary>
/// Gets or Sets the min value for the random number
/// </summary>
public int MinValue
{
get
{
return minValue;
}
set
{
minValue=value;
}
}
/// <summary>
/// Gets or Sets the max value for the random number
/// </summary>
public int MaxValue
{
get
{
return maxValue;
}
set
{
maxValue=value;
}
}
public int GenerateRandomNumber()
{
Random r=new Random();
return r.Next(MinValue, MaxValue);
}
}
}
Jerry