Create a new class or structure with the items you want to use:

Public Class Person
  Public ID as Integer
  Public Name as String
  Public Salary as Decimal
  Public Department as String

  Public Sub New(ByVal newID as Integer, ByVal personName as String,
ByVal currentSalary as Decimal, ByVal assignedDepartment as String)
    ID = newID
    Name = personName
    Salary = currentSalary
    Department = assignedDepartment
  End Sub
End Class


Sample Method to Create Person List:

Public Function CreatePersonList() as List(Of Person)
  Dim P1 as New Person(1,"John Doe", 12500.00, "Sales")
  Dim P2 as New Person(2,"Jane Doe", 15200.00, "Marketing")
  Dim P3 as New Person(3,"Peter Smith", 12400.00, "Sales")

  Dim PersonList as New List(Of Person)
  PersonList.Add(P1)
  PersonList.Add(P2)
  PersonList.Add(P3)

  Return PersonList
End Function

Enumerate the list:

Public Sub OutputList(ByVal PersonList as List(Of Person))
  For index as Integer = 0 to PersonList.Count - 1
    Console.WriteLine("{0} in {1} has a salary of {2}",
PersonList(index).Name, PersonList(index).Department,
PersonList(index).Salary)
  Next
End Sub


Hope this helps!

On Sep 18, 2:12 pm, hasan <[EMAIL PROTECTED]> wrote:
> I want to store diff attributes in the list
> like : ID,Name,Salary and other
> And i want to access that also by using list index.
> How???

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---

Reply via email to