In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to implement the c#lottery system for everyone. Xiaobian thinks it is quite practical, so share it with you for reference. I hope you can gain something after reading this article.
A simple lottery system based on c#, you can re-import data, empty data.
Code simple, more suitable for beginners.
When importing data, a txt text is created where you can see the input.
private void button1_Click(object sender, EventArgs e) //OK button { string path = System.IO.Directory.GetCurrentDirectory() + "//name.txt"; Random rand = new Random(System.Guid.NewGuid().GetHashCode()); string[] name = File.ReadAllLines(path); if (name.Length == 0) { MessageBox.Show("Import data cannot be empty! "); } else { textBox1.Text = name[rand.Next(0, name.Length)]; //Draw lots textBox1.ForeColor = Color.Black; } } private void button3_Click(object sender, EventArgs e) //import data { string qkong = ""; //Clear name.TXT string CurDir11 = System.AppDomain.CurrentDomain.BaseDirectory + @"name.txt.txt"; String filePath21 = CurDir11; System.IO.StreamWriter file11 = new System.IO.StreamWriter(filePath21, false); / file11.Write(qkong); file11.Close(); file11.Dispose(); string result = textBox2.Text.Trim(); string d = System.AppDomain.CurrentDomain.BaseDirectory + @"name.txt"; String filePath = d; System.IO.StreamWriter file1 = new System.IO.StreamWriter(filePath, false); file1.Write(result); file1.Close(); file1.Dispose(); MessageBox.Show("Import succeeded"); } private void button4_Click(object sender, EventArgs e) //Clear data { string qkong = ""; string s = System.AppDomain.CurrentDomain.BaseDirectory + @"name.txt.txt"; String filePath21 = s; System.IO.StreamWriter file11 = new System.IO.StreamWriter(filePath21, false); file11.Write(qkong); file11.Close(); file11.Dispose(); textBox2.Text = ""; } private void textBox2_TextChanged(object sender, EventArgs e) { this.textBox2.Multiline = true; } About "how to realize the c#lottery system" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.