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

?????? ????????? ?????? ?????????
???? ???????: 313640 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ???????. ????? "??? ??" ??? ??? ??????? ??? ????.
?????? ??? ????? Microsoft Visual C# .NET ?? ??? ???????? ???? 313634.
????? ???? | ?? ????

?? ??? ??????

??????

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

???????

???? ??????? ??????? ??????? ?????? ??? ????? ?????? ???????? ?????? ? ??? ??????? ???? ???????:
  • 2005 Visual Basic ?? Visual Basic .NET
????? ??? ??????? ????? ??? ?????? Visual Basic ?????? ???????.

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

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

????? ?????

??? ?? ???? ??? ???? ???? ??? ????? accessors ???????. ??? ?? ???? ?? ????? ???? ??? ?????? ????? ??????? ????? ???????. ????? ??? ???????? ??? ???? ?????? ?? ??? ??????? ????? ????? (??? ????? ???? ??? ?? ??? ?????). ????? ?????? ?? ??? ??????? ????? ??? ???? ??????? ??? ????? ?? ?? ??? ??? ?????.
Public Class guitar
    Private m_make As String
    Private m_model As String
    Private m_year As Short

    Public Sub New(ByVal make, ByRef model, ByVal year)
        Me.make = make
        Me.model = model
        Me.year = year
    End Sub
    Public Property make() As String
        Get
            Return m_make
        End Get
        Set(ByVal Value As String)
            m_make = Value
        End Set
    End Property
End Class
				

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

?????? ??????? ?? ????? ?????? ???????? ??? ??? ArrayList:
Private al As New ArrayList()

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

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

??? ?? ??? ????? ArrayList ????? ??? ????? ????? ?????? ??? ????? ???? ??????? Windows. ?????? ????? ?? ???????? ??????? Add ??????? DataBindings ????? ???? ???? ??. ???????? ??? ???? ????? ????? ???? ?????? ???? ???? ??? ? ??? ArrayList ? ????? ??????.
TextBox1.DataBindings.Add("Text", al, "Make")
TextBox2.DataBindings.Add("Text", al, "Model")
TextBox3.DataBindings.Add("Text", al, "Year")
				

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

?? ?????? ??????? ?? ??? ??????? ??????? ??? CurrencyManager ???????? ArrayList. ?????? ????? ?? ?????? CurrencyManagerBindingContext ??????? (?? ??? ??????? 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 2005 ?? ?? Visual Basic .NET. ??? ????? Form1 ??? ??????? ???? ???????.

    ?????? ??? ????? ????????? ???????? ?? Visual Basic 2005. ???? ???????? ????? Visual Basic ????? ??????? ??? ????? Windows ??????? ???????. ??? ?? ????? ??????? Form1, ??? ????? ??????? ???? ???? ??????? Form1.vb ? Form1.Designer.vb. ????? ????????? ???????? ?? ??? Form1.vb. ???? ????? Windows ?????? ???????? ???????? ?? ??? Form1.Designer.vb. ????? Windows ?????? ???? ?????? ???????? ??????? ?????? ????? Form1 ??? ????? ??????. ???? ??? ?????? ?? ????????? ???????? ???? ?? ??????? ???? ?? ??? interspersed ?? ????????? ???????? ?????? ??.

    ????? ?? ????????? ??? ??????? ????? 2005 Visual Basic ??????? ???? Microsoft ??????? ??? ?????? ?????? ???? ??? (MSDN):
    http://msdn2.microsoft.com/en-us/library/ms379584(vs.80).aspx
    ????? ?? ????????? ??? ???? ????? "?" ???? ????? Windows ?? ?????? ???? MSDN ??????:
    http://msdn2.microsoft.com/en-us/library/ms171843.aspx
  2. ????? ??? ??? ???????.
  3. ??????? ????? ?? Class1.vb ???????? ???????? ???????:
    Public Class guitar
        Private m_make As String
        Private m_model As String
        Private m_year As Short
    
        Public Sub New(ByVal make, ByRef model, ByVal year)
            Me.make = make
            Me.model = model
            Me.year = year
        End Sub
        Public Property make() As String
            Get
                Return m_make
            End Get
            Set(ByVal Value As String)
                m_make = Value
            End Set
        End Property
        Public Property model() As String
            Get
                Return m_model
            End Get
            Set(ByVal Value As String)
                m_model = Value
            End Set
        End Property
        Public Property year() As Short
            Get
                Return m_year
            End Get
            Set(ByVal Value As Short)
                m_year = Value
            End Set
        End Property
    End Class
    					
  4. ????? ????? ????? ???? ???? ?? ??? Form1 ??? ?? ????? ????? ?????? ??????.
  5. ????? ????? ????? ???? ?? ??? Form1 ??? ?? ????? ????? ?????? ??????.
  6. ????? ??????? Text ??????? ??? ???:
    ?? ??? ??????????? ??? ??????
    ??????
    Button1??????
    Button2??????
    Button3?????
    Button4??????
  7. ?? ?????? ????????? ???????? ??????? ??? ?????? ????? Form1:
    Private al As New ArrayList()
    Private cMan As CurrencyManager
    					
  8. ?? ?????? ????????? ???????? ??????? ??? ????? Form_Load:
    al.Add(New guitar("Gibson", "Les Paul", 1958))
    al.Add(New guitar("Fender", "Jazz Bass", 1964))
    al.Add(New Guitar("Guild", "Bluesbird", 1971))
    
    cMan = CType(Me.BindingContext(al), CurrencyManager)
    
    TextBox1.DataBindings.Add("Text", al, "make")
    TextBox2.DataBindings.Add("Text", al, "model")
    TextBox3.DataBindings.Add("Text", al, "year")
    					
  9. ?? ?????? ????????? ???????? ??????? ??? ????? 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
    					
  10. ?????? ??????? ???????.
  11. ???? ??? ??????? ???? ????? ?????? ??????. ???? ??? ????? ????? ??? ????????.

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

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

?????

????? ?? ?????????? ???? ??????? "???????? ??? Windows ????? ????????" ?? ????? Visual Studio 2005 ?? Visual Studio .NET ????????? ??? ??????.

???????

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

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