欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

c#抽簽系統(tǒng)的實(shí)現(xiàn)示例

 更新時(shí)間:2021年10月31日 10:51:30   作者:707電力電子  
本文主要介紹了c#抽簽系統(tǒng)的實(shí)現(xiàn)示例,一個(gè)基于c#的簡單抽簽系統(tǒng),可以重新導(dǎo)入數(shù)據(jù),清空數(shù)據(jù)。文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

一個(gè)基于c#的簡單抽簽系統(tǒng),可以重新導(dǎo)入數(shù)據(jù),清空數(shù)據(jù)。
代碼簡單,比較適合初學(xué)者。

在這里插入圖片描述

導(dǎo)入數(shù)據(jù)時(shí)會(huì)創(chuàng)建一個(gè)txt文本,可以在里面看到輸入

導(dǎo)入數(shù)據(jù)時(shí)會(huì)創(chuàng)建一個(gè)txt文本,可以在里面看到輸入

private void button1_Click(object sender, EventArgs e)   //確定按鈕
        {
            string path = System.IO.Directory.GetCurrentDirectory() + "http://name.txt";     
             Random rand = new Random(System.Guid.NewGuid().GetHashCode());               
             string[] name = File.ReadAllLines(path);                          
            if (name.Length == 0)
            {
                MessageBox.Show("導(dǎo)入數(shù)據(jù)不能為空!");
            }
            else
            {
                textBox1.Text = name[rand.Next(0, name.Length)];              //抽簽          
                textBox1.ForeColor = Color.Black;
            }
        }
         private void button3_Click(object sender, EventArgs e)     //導(dǎo)入數(shù)據(jù)
        {
            string qkong = "";                                                               //清空name.TXT
            string CurDir11 = System.AppDomain.CurrentDomain.BaseDirectory + @"name.txt.txt";    
            String filePath11 = CurDir11;
            System.IO.StreamWriter file11 = new System.IO.StreamWriter(filePath11, 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("導(dǎo)入成功");
        }
        private void button4_Click(object sender, EventArgs e)      //清空數(shù)據(jù)
        {
            string qkong = "";                                                              
            string s = System.AppDomain.CurrentDomain.BaseDirectory + @"name.txt.txt";   
            String filePath11 = s;
            System.IO.StreamWriter file11 = new System.IO.StreamWriter(filePath11, false);     
            file11.Write(qkong);                                                              
            file11.Close();                                                                  
            file11.Dispose();                                                                
            textBox2.Text = "";
        }
        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            this.textBox2.Multiline = true;
        }

到此這篇關(guān)于c#抽簽系統(tǒng)的實(shí)現(xiàn)示例的文章就介紹到這了,更多相關(guān)c# 抽簽系統(tǒng)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論