winform項目筆記:

來源:互聯網
上載者:User

標籤:view   oda   伺服器控制項   直接   info   his   資料   input   程式   

餐飲管理系統:三層架構模式。

Modal,bll,dal,UI,Common.  

知識點:     using語句釋放的是非託管的資源。託管的資源會有CLR自動釋放。

    DataGridView控制項:      dataGridView1.AutoGenerateColumns = false; 把自動產生列關掉。

  事件其實也是一個方法,想要調用的時候,btnCancel_Click(null,null);

     刪除的時候,判斷是否刪除的提示框:     DialogResult result= MessageBox.Show("確定要刪除嗎","提示",MessageBoxButtons.OKCancel);    

         if (result==DialogResult.OK)     

        {        

         MessageBox.Show("可以刪除了");    

         }       

 winform中 : 後台載入中使用 this.textBox1.PasswordChar = ‘搜尋*‘; 或者你可以直接設定其屬性PasswordChar的值為*   

         如果你是使用的伺服器控制項那麼 就設定 textbox的textmode=“password”就好了即:             <asp:TextBox ID="TextBox1" runat="server" TextMode="Password"></asp:TextBox>

         如果是html的就用:          如<input type="password" value="你將要填寫的值" />   

      winform中的,從主表單開啟子表單,如果把主表單關閉掉,那麼從它的子表單也都關閉了。所以要用this.Visible=false;不要直接用this.Close();

   我們可以通過表單的Tag屬性進行表單間的資料傳遞。

       private void button1_Click(object sender, EventArgs e)  

       {      

       MainForm mainf = new MainForm();   

        mainf.Tag = 2;        

  mainf.Show();  

        this.Visible = false;   

      }   

    private void MainForm_Load(object sender, EventArgs e)   

      {      

       if (this.Tag.ToString() == "1")         

    {            

     MessageBox.Show("父表單傳遞過來了");   

          }        

}        

    表單間傳值:表單的Tag屬性。      

     引用NPOI程式集:Excel的匯入匯出功能。

  .net中的非託管資源是需要手動釋放的。

比如說建立檔案,並儲存到硬碟裡,這裡儲存完就需要   Dispose()。

  FileStrea  file=new FileStream(@"C:\Users\ql\Desktop\b.xls",FileMode.CreateNew,FileAccess.Write);    

  workbook.Write(file);  

 file.Dispose();        

子表單想改變父表單裡的變數,用事件去做。

winform項目筆記:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.