自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

VB.NET Account對(duì)象簡(jiǎn)介

開發(fā) 后端
本文介紹三個(gè)文本框都用于保持當(dāng)前VB.NET Account對(duì)象的數(shù)據(jù)。它們分別叫txtAccountID、txtCustomerName和 txtBalance.顯示Load的按鈕叫btnLoad,用于載入帳號(hào)集合。

VB.NET有很多值得學(xué)習(xí)的地方,這里我們主要介紹VB.NET Account對(duì)象,包括介紹是Load方法的Click事件等方面。

本文介紹三個(gè)文本框都用于保持當(dāng)前VB.NET Account對(duì)象的數(shù)據(jù)。它們分別叫txtAccountID、txtCustomerName和 txtBalance.顯示Load的按鈕叫btnLoad,用于載入帳號(hào)集合。另兩個(gè)按鈕在記錄間導(dǎo)航,分別叫btnBack 和 btnForward.

帳號(hào)對(duì)象集合可以保持在ArrayList(數(shù)組列表)中,因此下面一行代碼應(yīng)該在窗體代碼的最前面:

Dim colAccounts As ArrayList

下面是Load方法的Click事件代碼。它建立了一些VB.NET Account對(duì)象并把它們放入一個(gè)集合中,接著把該集合綁定到文本框。

  1. colAccounts = New ArrayList()  
  2. colAccounts.Add(New Account(1, "ABC Company", 10))  
  3. colAccounts.Add(New Account(2, "XYZ, Inc.", -10))  
  4. colAccounts.Add(New Account(3, "MNP Limited", 0))  
  5.  
  6. txtAccountID.DataBindings.Add(New _   
  7. Binding("Text", colAccounts, "AccountID"))  
  8. txtCustomerName.DataBindings.Add(New _   
  9. Binding("Text", colAccounts, "CustomerName"))  
  10. txtBalance.DataBindings.Add(New _  
  11. Binding("Text", colAccounts, "Balance"))  
  12. txtBalance.DataBindings.Add(New _   
  13. Binding("BackColor", colAccounts, "BackColor")) 

注意最后兩行。txtBalance的Text屬性綁定到一個(gè)帳號(hào)的Balance屬性,并且該控件的BackColor屬性綁定到帳號(hào)對(duì)象的BackColor屬性。它演示了。NET框架組件綁定一個(gè)以上屬性到不同數(shù)據(jù)項(xiàng)。

現(xiàn)在點(diǎn)擊btnBack的Click事件,填入一下代碼:

  1. If Me.BindingContext(colAccounts).Position > 0 Then  
  2. Me.BindingContext(colAccounts).Position -1 
  3. End If  
  4. 在btnForward的Click事件中寫入以下代碼:  
  5. If Me.BindingContext(colAccounts).Position < colAccounts.Count - 1 Then  
  6. Me.BindingContext(colAccounts).Position += 1  
  7. End If 

【編輯推薦】

  1. 簡(jiǎn)單描述VB.NET散列函數(shù)
  2. 詳細(xì)分析VB.NET讀寫文本文件
  3. VB.NET GroupBox控件學(xué)習(xí)經(jīng)驗(yàn)
  4. 概括VB.NET DomainUpDown控件
  5. VB.NET編碼算法學(xué)習(xí)筆記
責(zé)任編輯:佚名 來(lái)源: IT168
相關(guān)推薦

2010-01-15 16:29:47

VB.NET對(duì)象存儲(chǔ)

2009-10-28 17:44:31

VB.NET語(yǔ)言

2009-10-30 15:37:23

VB.NET Sub創(chuàng)

2009-10-16 11:38:47

VB.NET使用Ali

2009-10-15 09:16:35

VB.NET重新申明數(shù)

2009-10-09 15:59:41

VB.NET對(duì)象

2009-11-02 17:54:44

VB.NET數(shù)組

2009-10-12 14:13:00

VB.NET使用局部變

2010-01-12 18:05:38

VB.NET對(duì)象

2009-10-30 11:20:54

VB.NET Proc

2009-10-12 16:39:59

OracleTransVB.NET使用

2010-01-22 13:28:13

VB.NET對(duì)象克隆

2009-11-02 16:22:16

VB.NET面向?qū)ο?/a>

2009-10-23 14:06:07

VB.NET類對(duì)象

2009-10-13 17:03:55

VB.NET面向?qū)ο?/a>

2009-11-03 10:09:48

VB.NET對(duì)象

2010-01-19 15:08:18

VB.NET對(duì)象成員

2010-01-21 12:55:08

VB.NET對(duì)象序列

2009-11-03 13:33:39

VB.NET對(duì)象列表

2009-10-20 17:38:20

VB.NET exce
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)