SelectedDatesCollection.CopyTo メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim instance As SelectedDatesCollection Dim array As Array Dim index As Integer instance.CopyTo(array, index)

このメソッドを使用して、指定した System.Array に SelectedDatesCollection コレクションの内容をコピーします。コピー操作は、指定したインデックス位置から始まります。
![]() |
---|

CopyTo メソッドを使用して、指定した配列に SelectedDatesCollection の項目をコピーする方法を次のコード例に示します。
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> <script runat="server"> Sub Select_Change(sender As Object, e As EventArgs) Dim myDateArray(Calendar1.SelectedDates.Count) As DateTime ' Copy the collection to array. Calendar1.SelectedDates.CopyTo(myDateArray, 0) Label1.Text = "The dates selected are: " ' Loop through the IEnumerator and display the contents. Dim theDate As DateTime For Each theDate In myDateArray Label1.Text &= " " & theDate.Day.ToString() Next End Sub </script> </head> <body> <form runat="server"> <asp:Calendar ID="Calendar1" runat="server" SelectionMode="DayWeekMonth" OnSelectionChanged="Select_Change"/> <hr> Select dates from the Calendar.<br><br> <asp:Label id="Label1" runat=server /> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script runat="server"> void Select_Change(Object sender, EventArgs e) { DateTime[] myDateArray = new DateTime[Calendar1.SelectedDates.Count]; // Copy the collection to an array. Calendar1.SelectedDates.CopyTo(myDateArray, 0); Label1.Text = "The dates selected are: "; // Loop through the IEnumerator and display the contents. foreach (DateTime date in myDateArray) { Label1.Text += " " + date.Day.ToString(); } } </script> </head> <body> <form runat="server"> <asp:Calendar ID="Calendar1" runat="server" SelectionMode="DayWeekMonth" OnSelectionChanged="Select_Change"/> <hr> Select dates from the Calendar.<br><br> <asp:Label id="Label1" runat=server /> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からSelectedDatesCollection.CopyTo メソッドを検索する場合は、下記のリンクをクリックしてください。

- SelectedDatesCollection.CopyTo メソッドのページへのリンク