The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CurrencyManager.List Property

Gets the list for this CurrencyManager.

[Visual Basic]
Public ReadOnly Property List As IList
public IList List {get;}
public: __property IList* get_List();
public function get List() : IList;

Property Value

An IList object that contains the list.


The object returned by the List property can be cast to any type that implments the IList interface. This will be commonly used when you know the type of the underlying list. For example, if you are data bound to a DataSet, the underlying list is a DataView (which implements IList). Other classes that implement the interface (this is not a complete list) include: Array, ArrayList, and CollectionBase.

How you use the List property depends on the class that implements the IList interface. For example, you can use the List property to determine the name of the list. If the data source implements the ITypedList interface, you can use the GetListName method to return the name of the current table. This is shown in the C# code below:

private void PrintCurrentListName(DataGrid myDataGrid){ 
   CurrencyManager myCM = (CurrencyManager) 
   BindingContext[myDataGrid.DataSource, myDataGrid.DataMember]; 
   IList myList = myCM.List; 
   ITypedList thisList = (ITypedList) myList; 


[Visual Basic, C#, C++] The following example allow users to edit a set of records, but not add any new ones. In the Navigate event of a DataGrid control, the IList returned by the List property is cast to a DataView variable. The DataView object's AllowNew is set to false.

[Visual Basic] 
Private Sub Grid_Navigate(sender As Object, e As NavigateEventArgs)
   If e.Forward Then
      Dim ds As DataSet = CType(grid.DataSource, DataSet)
      Dim cm As CurrencyManager = _
      CType(BindingContext(ds,"Customers.CustOrders"), CurrencyManager)
      ' Cast the IList to a DataView to set the AllowNew property.
      Dim dv As DataView = CType(cm.List, DataView)
      dv.AllowNew = false
   End If
End Sub

private void Grid_Navigate(object sender, NavigateEventArgs e){
   if (e.Forward ){
      DataSet ds = (DataSet) grid.DataSource;
      CurrencyManager cm  = 
      // Cast the IList to a DataView to set the AllowNew property.
      DataView dv  = (DataView) cm.List;
      dv.AllowNew = false;

    void Grid_Navigate(Object* /*sender*/, NavigateEventArgs* e) {
        if (e->Forward) {
            DataSet* ds = dynamic_cast<DataSet*> (grid->DataSource);
            CurrencyManager* cm  =
                    BindingContext->get_Item(ds, S"Customers::CustOrders"));
            // Cast the IList* to a DataView to set the AllowNew property.
            DataView* dv  = dynamic_cast<DataView*>(cm->List);
            dv->AllowNew = false;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

CurrencyManager Class | CurrencyManager Members | System.Windows.Forms Namespace

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft