Clears the entire collection : NameValueCollection « Data Structure « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » Data Structure » NameValueCollectionScreenshots 
Clears the entire collection
 

Imports System
Imports System.Collections
Imports System.Collections.Specialized


Public Class SamplesNameValueCollection
    Public Shared Sub Main()
        Dim myCol As New NameValueCollection()
        myCol.Add("A""aa")
        myCol.Add("B""bb")
        myCol.Add("C""cc")
        myCol.Add("D""dd")

        myCol.Clear()
        PrintKeysAndValues(myCol)

    End Sub 'Main

    Public Shared Sub PrintKeysAndValues(myCol As NameValueCollection)
        Dim As String
        For Each s In  myCol.AllKeys
            Console.WriteLine("   {0,-10} {1}", s, myCol(s))
        Next s
    End Sub 

    Public Shared Sub PrintKeysAndValues2(myCol As NameValueCollection)
        Dim As Integer
        For i = To myCol.Count - 1
            Console.WriteLine("   [{0}]     {1,-10} {2}", i, myCol.GetKey(i), myCol.Get(i))
        Next i
    End Sub
End Class

   
  
Related examples in the same category
1.Simple Demo for NameValueCollectionSimple Demo for NameValueCollection
2.NameValueCollection Class represents String keys and String values
3.Copies the values to a string array and displays the string array
4.Searches for a key and deletes it
ww__w_.___ja___v__a_2_s_._c___om | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.