????? ??? ??? ArrayList ?? ?????? ?? ????? ??? ????? Windows ???????? Visual Basic .NET ?? Visual Basic 2005

?????? ????????? ?????? ?????????
???? ???????: 313638 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ???????. ????? "??? ??" ??? ??? ??????? ??? ????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ???? ????? ??? ????? ??? ArrayList ?????? ??? ????? Windows. ????? ?????? ????? Windows ????? ?????? ?????? ???? ????? ???? ????? ????? ??????? ?????? ???? ArrayList.

???????

Microsoft Visual Basic .NET ?? Microsoft Visual Basic 2005

?????? ???

??? ??? ?????? ???????? ?????? ????? ???????? ?????? ??? ??????.

????? ?? ????

??? ?? ???? ???? ?? ???? ?????? ??? ????? accessors ?????. ?? ???? ??? accessors ?????? ??? ?????? ????? / ????? ???? ???? ??? ?????? ????? ?? ???. ????? ???? ????????? ??? ???? ?????? ?? ??? ??????? ????? ????? (??? ????? ???? ???). ???? ??????? ??? ????? ????? ???? ??? ??????.
Private Structure guitar
    Friend mmake As String
    Friend mmodel As String
    Friend myear As Short

    Public Sub New(ByVal make, ByVal model, ByVal year)
        Me.mmake = make
        Me.mmodel = model
        Me.myear = year
    End Sub

    Public Property make() As String
        Get
            make = mmake
        End Get
        Set(ByVal Value As String)
            mmake = Value
        End Set
    End Property
End Structure
				

????? ?????? ???? ??? ArrayList

????? ?????? T ?? ??????? ??? ArrayList ? ???? ??????? ???????:
  1. ??????? ?? ?????? ?? ??? ??????.
  2. ?? ?????? ArrayList.
  3. ????? ?????? ?????? ??? ?? ????? ??????? ??? ArrayList.
Private myStruct As guitar
Dim al As New ArrayList()

myStruct = New guitar("Gibson", "Les Paul", 1958)
al.Add(myStruct) 
myStruct = New guitar("Fender", "Jazz Bass", 1964)
al.Add(myStruct)
myStruct = New guitar("Guild", "Bluesbird", 1971)
al.Add(myStruct)
				

??? ??????? ???? ????? ???? ???????

??? ?? ??? ????? ArrayList ????? ??? ????? ??????? ?? ?????? ????? ???? ??????? Windows. ?????? ????? ??? ??????? ??????? ????? ??????? DataBindings ???? ?? ?? ????? ????? ??? ? ??? ArrayList ? ??? ??????.
TextBox1.DataBindings.Add("Text", al, "make")
TextBox2.DataBindings.Add("Text", al, "model")
TextBox3.DataBindings.Add("Text", al, "year")
				

????? Way ??? ??? ??? ArrayList

?????? ??????? ?? ??????? ?????? ????? ?????? ???? ArrayList. ?????? ????? ??? ???? ??????? CurrencyManager. ????? CurrencyManager ??????? BindingContext ? ?? ??? ??????? ArrayList ?????.
Private cMan As CurrencyManager

cMan = CType(Me.BindingContext(al), CurrencyManager)
				
????? ?????? CurrencyManager ????? ???? ??????? ???? ????? ??? ????? ArrayList. ?? ???? ????? ??? ?? ??? ?? ???? ?????? ??????, ????? ??? ?????? ????? ArrayList ?? ???????.
'Move forward one element.
 cMan.Position += 1
'Move back one element.
cMan.Position -= 1
'Move to the beginning.
cMan.Position = 0
'Move to the end.
cMan.Position = al.Count - 1
				

???? ???? ?????

  1. ??? ????? ????? Windows ???? ?? Visual Basic .NET ?? 2005 Visual Basic.
  2. ????? ????? ?????? ???? ??? Form1 ??? ?? ????? ????? ?????? ??????.
  3. ????? ????? ????? ??????? ??? Form1 ??? ?? ????? ????? ?????? ??????.
  4. ????? ????? ?? Button1 ??? ??????.
  5. ????? ????? ?? Button2 ??? ??????.
  6. ????? ????? ?? Button3 ??? ?????.
  7. ????? ????? ?? Button4 ??? ???.
  8. ?? ?????? ????????? ???????? ??????? ??? ?????? Form1 ???????:
    Private Structure guitar
        Friend mmake As String
        Friend mmodel As String
        Friend myear As Short
    
        Public Sub New(ByVal make, ByVal model, ByVal year)
            Me.mmake = make
            Me.mmodel = model
            Me.myear = year
        End Sub
    
        Public Property make() As String
            Get
                make = mmake
            End Get
            Set(ByVal Value As String)
                mmake = Value
            End Set
        End Property
        Public Property model() As String
            Get
                model = mmodel
            End Get
            Set(ByVal Value As String)
                mmodel = Value
            End Set
        End Property
        Public Property year() As Short
            Get
                year = myear
            End Get
            Set(ByVal Value As Short)
    
    
            myear = Value
            End Set
        End Property
    End Structure
    
    Private myStruct As guitar
    Private al As New ArrayList()
    Private cMan As CurrencyManager
    					
  9. ?? ?????? ????????? ???????? ??????? ??? ????? Form_Load:
    myStruct = New guitar("Gibson", "Les Paul", 1958)
    al.Add(myStruct)
    myStruct = New guitar("Fender", "Jazz Bass", 1964)
    al.Add(myStruct)
    myStruct = New guitar("Guild", "Bluesbird", 1971)
    al.Add(myStruct)
    
    cMan = CType(Me.BindingContext(al), CurrencyManager)
    
    TextBox1.DataBindings.Add("Text", al, "make")
    TextBox2.DataBindings.Add("Text", al, "model")
    TextBox3.DataBindings.Add("Text", al, "year")
    					
  10. ?? ?????? ????????? ???????? ??????? ??? ????? Form_Load:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button1.Click
            cMan.Position += 1
    End Sub
    
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button2.Click
            cMan.Position -= 1
    End Sub
    
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button3.Click
            cMan.Position = 0
    End Sub
    
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button4.Click
            cMan.Position = al.Count - 1
    End Sub
    					
  11. ?????? ??????? ???????.
  12. ???? ??? ??????? ???? ????? ArrayList ??????. ???? ??? ????? ????? ??? ????????.

??????? ??????

???? ??????? ???? ?????? ????? ??? ???????. ??????? ??????? ?????? ???? ????? ?????? ?? ????????? ???????? ?? ????? ????? Form_Load:
Private al As New ArrayList()
??????? ??? ????????? ???????? ?????? ???? ?????? ?? ?? ?????? ?????? ??? ????:
Private al As New Collection()

?????

???? ??????? ?????? ?? ??????? Visual Studio .NET ?? Visual Studio 2005 ????????? ??? ??????:
???????? ???????? ?? ??????? Windows

???????

???? ???????: 313638 - ????? ??? ??????: 28/???? ??????/1435 - ??????: 3.3
????? ???
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic 2005
????? ??????: 
kbnosurvey kbarchive kbmt kbvs2005swept kbvs2005applies kbhowtomaster KB313638 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????313638

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com