社区
C#
帖子详情
如何实现随机抽取20个手机号码
rainlow
2006-11-20 05:24:39
各位: 现界面上有"开始","停止"按钮, 按钮下面有个文本框,当点击"开始"按钮时,系统开始从数据库读取数据(手机号),并要求在界面上滚动显示(与电视上看到的产生幸运号码类似).单击停止时显示随机抽取的20个号码. 请问用C#如何实现这样的功能.
...全文
870
20
打赏
收藏
如何实现随机抽取20个手机号码
各位: 现界面上有"开始","停止"按钮, 按钮下面有个文本框,当点击"开始"按钮时,系统开始从数据库读取数据(手机号),并要求在界面上滚动显示(与电视上看到的产生幸运号码类似).单击停止时显示随机抽取的20个号码. 请问用C#如何实现这样的功能.
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
20 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
puny
2006-12-08
打赏
举报
回复
我有写过一个抽奖小程序,要的话,可以发给你
colaxu
2006-12-08
打赏
举报
回复
先取出数据库中的手机号,然后用一随机数来控制滚动显示的手机号码(控制文本框里只有20个号码,不重复).停止之后最后选中的20个号码就是幸运号码了
ilove8
2006-12-08
打赏
举报
回复
up
L-星星火
2006-12-08
打赏
举报
回复
组数+随机数,取出一个后,把这个从中删掉,继续下一步
GaoGaoWuDi
2006-12-08
打赏
举报
回复
this.lab4.AutoSize = true;
this.lab4.Font = new System.Drawing.Font("Arial", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lab4.Location = new System.Drawing.Point(136, 4);
this.lab4.Name = "lab4";
this.lab4.Size = new System.Drawing.Size(36, 40);
this.lab4.TabIndex = 8;
this.lab4.Text = "0";
//
// lab8
//
this.lab8.AutoSize = true;
this.lab8.Font = new System.Drawing.Font("Arial", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lab8.Location = new System.Drawing.Point(312, 4);
this.lab8.Name = "lab8";
this.lab8.Size = new System.Drawing.Size(36, 40);
this.lab8.TabIndex = 9;
this.lab8.Text = "0";
//
// lab2
//
this.lab2.AutoSize = true;
this.lab2.Font = new System.Drawing.Font("Arial", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lab2.Location = new System.Drawing.Point(48, 4);
this.lab2.Name = "lab2";
this.lab2.Size = new System.Drawing.Size(36, 40);
this.lab2.TabIndex = 9;
this.lab2.Text = "0";
//
// lab11
//
this.lab11.AutoSize = true;
this.lab11.Font = new System.Drawing.Font("Arial", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lab11.Location = new System.Drawing.Point(444, 4);
this.lab11.Name = "lab11";
this.lab11.Size = new System.Drawing.Size(36, 40);
this.lab11.TabIndex = 10;
this.lab11.Text = "0";
//
// list1
//
this.list1.FormattingEnabled = true;
this.list1.ItemHeight = 12;
this.list1.Location = new System.Drawing.Point(12, 63);
this.list1.Name = "list1";
this.list1.Size = new System.Drawing.Size(183, 100);
this.list1.TabIndex = 11;
//
// button1
//
this.button1.Location = new System.Drawing.Point(224, 106);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(109, 57);
this.button1.TabIndex = 12;
this.button1.Text = "开始";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(361, 106);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(109, 57);
this.button2.TabIndex = 13;
this.button2.Text = "停止";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// panel1
//
this.panel1.Controls.Add(this.lab1);
this.panel1.Controls.Add(this.lab3);
this.panel1.Controls.Add(this.lab5);
this.panel1.Controls.Add(this.lab7);
this.panel1.Controls.Add(this.lab11);
this.panel1.Controls.Add(this.lab9);
this.panel1.Controls.Add(this.lab2);
this.panel1.Controls.Add(this.lab10);
this.panel1.Controls.Add(this.lab8);
this.panel1.Controls.Add(this.lab6);
this.panel1.Controls.Add(this.lab4);
this.panel1.Location = new System.Drawing.Point(12, 8);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(492, 48);
this.panel1.TabIndex = 14;
//
// info1
//
this.info1.AutoSize = true;
this.info1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.info1.Location = new System.Drawing.Point(231, 71);
this.info1.Name = "info1";
this.info1.Size = new System.Drawing.Size(116, 19);
this.info1.TabIndex = 15;
this.info1.Text = "等待中.....";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(526, 179);
this.Controls.Add(this.info1);
this.Controls.Add(this.panel1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.list1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
GaoGaoWuDi
2006-12-08
打赏
举报
回复
//
// lab3
//
this.lab3.AutoSize = true;
this.lab3.Font = new System.Drawing.Font("Arial", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lab3.Location = new System.Drawing.Point(92, 4);
this.lab3.Name = "lab3";
this.lab3.Size = new System.Drawing.Size(36, 40);
this.lab3.TabIndex = 2;
this.lab3.Text = "0";
//
// lab5
//
this.lab5.AutoSize = true;
this.lab5.Font = new System.Drawing.Font("Arial", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lab5.Location = new System.Drawing.Point(180, 4);
this.lab5.Name = "lab5";
this.lab5.Size = new System.Drawing.Size(36, 40);
this.lab5.TabIndex = 3;
this.lab5.Text = "0";
//
// lab7
//
this.lab7.AutoSize = true;
this.lab7.Font = new System.Drawing.Font("Arial", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lab7.Location = new System.Drawing.Point(268, 4);
this.lab7.Name = "lab7";
this.lab7.Size = new System.Drawing.Size(36, 40);
this.lab7.TabIndex = 4;
this.lab7.Text = "0";
//
// lab9
//
this.lab9.AutoSize = true;
this.lab9.Font = new System.Drawing.Font("Arial", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lab9.Location = new System.Drawing.Point(356, 4);
this.lab9.Name = "lab9";
this.lab9.Size = new System.Drawing.Size(36, 40);
this.lab9.TabIndex = 5;
this.lab9.Text = "0";
//
// lab10
//
this.lab10.AutoSize = true;
this.lab10.Font = new System.Drawing.Font("Arial", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lab10.Location = new System.Drawing.Point(400, 4);
this.lab10.Name = "lab10";
this.lab10.Size = new System.Drawing.Size(36, 40);
this.lab10.TabIndex = 6;
this.lab10.Text = "0";
//
// lab6
//
this.lab6.AutoSize = true;
this.lab6.Font = new System.Drawing.Font("Arial", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lab6.Location = new System.Drawing.Point(224, 4);
this.lab6.Name = "lab6";
this.lab6.Size = new System.Drawing.Size(36, 40);
this.lab6.TabIndex = 7;
this.lab6.Text = "0";
//
// lab4
//
GaoGaoWuDi
2006-12-08
打赏
举报
回复
吃饭的时候瞎写了一个,不过好烂,兄弟们别笑话.
VS2005
-----------------------------------------------------------------------------------
namespace Obtain
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.lab1 = new System.Windows.Forms.Label();
this.lab3 = new System.Windows.Forms.Label();
this.lab5 = new System.Windows.Forms.Label();
this.lab7 = new System.Windows.Forms.Label();
this.lab9 = new System.Windows.Forms.Label();
this.lab10 = new System.Windows.Forms.Label();
this.lab6 = new System.Windows.Forms.Label();
this.lab4 = new System.Windows.Forms.Label();
this.lab8 = new System.Windows.Forms.Label();
this.lab2 = new System.Windows.Forms.Label();
this.lab11 = new System.Windows.Forms.Label();
this.list1 = new System.Windows.Forms.ListBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.info1 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// lab1
//
this.lab1.AutoSize = true;
this.lab1.Font = new System.Drawing.Font("Arial", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lab1.Location = new System.Drawing.Point(4, 4);
this.lab1.Name = "lab1";
this.lab1.Size = new System.Drawing.Size(36, 40);
this.lab1.TabIndex = 0;
this.lab1.Text = "0";
Summer11123
2006-12-08
打赏
举报
回复
puny 这位兄弟,发给我~~~
E-mail:Summer11123@163.com
谢谢
ymmzl
2006-11-21
打赏
举报
回复
先取20个 1至n范围的随机数 (n为记录总数)
然后,从数据库中取出这些记录.
要不然,随机找个位置(1至n-20),取出连续的20条记录.
babyrockxray
2006-11-21
打赏
举报
回复
随即生成序号,就可以了
gui0605
2006-11-21
打赏
举报
回复
随机生成20个ID号,然后根据ID号查询数据库就得到了
smbeng
2006-11-21
打赏
举报
回复
要固定的20个不重复的.
多线程?那应该是20个线程每个取一个?
ilove8
2006-11-21
打赏
举报
回复
读取手机数据的记录数,再在这个范围随机生成以个数,提取这个手机数据
rainlow
2006-11-21
打赏
举报
回复
多线程方面能否提点意见?
rainlow
2006-11-21
打赏
举报
回复
??
ruan_hg
2006-11-21
打赏
举报
回复
滚动显示可能要用js实现吧?
siugwan
2006-11-20
打赏
举报
回复
sql server?
select top 20 tel from yourtable order by newid()
rainlow
2006-11-20
打赏
举报
回复
各位还有思路或者源码么
guyan1220
2006-11-20
打赏
举报
回复
数组+随机函数
sean840610
2006-11-20
打赏
举报
回复
使用多线程编写,使用随机数从数据库中读取
choujiang-js.rar_
随机
_
随机
抽取
一个有js
实现
的
随机
抽奖代码(
随机
抽取
手机号码
)
Java实例-幸运观众
手机号码
抽取
器.doc
Java实例-幸运观众
手机号码
抽取
器
手机号码
抽奖程序
按
手机号码
作为抽奖依据 程序小巧方便,不需要安装,只有一个HTML文件。 使用方便,只需修改的要抽奖的
手机号码
。
JS
实现
手机号码
抽奖功能
用js
实现
的
手机号码
抽奖功能,由三等奖开始
抽取
,填满三等奖,填二等奖,之后填1等奖,源码完整,可以改!
jQuery
随机
抽中
手机号码
抽奖特效代码
jQuery
随机
抽中
手机号码
抽奖代码是一款
手机号码
中间4位隐藏显示,可以内定中奖者。
C#
111,120
社区成员
642,545
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章