CurrencyManager.Refresh 메서드

정의

데이터 바인딩된 목록을 강제로 다시 채웁니다.

public:
 void Refresh();
public void Refresh ();
member this.Refresh : unit -> unit
Public Sub Refresh ()

예제

다음 코드 예제에서는 배열을 만들고 컨트롤에 TextBox 바인딩한 다음 하나의 값을 변경합니다. 메서드를 Refresh 호출하여 컨트롤에 표시되는 값을 업데이트할 TextBox 수 있습니다.

void DemonstrateRefresh()
{
   
   // Create an array with ten elements and bind to a TextBox.
   array<String^>^myArray = gcnew array<String^>(10);
   for ( int i = 0; i < 10; i++ )
   {
      myArray[ i ] = String::Format( "item {0}", i );

   }
   textBox1->DataBindings->Add( "Text", myArray, "" );
   
   // Change one value.
   myArray[ 0 ] = "New value";
   
   // Uncomment the next line to refresh the CurrencyManager.
   // RefreshGrid(myArray);
}

void RefreshGrid( Object^ dataSource )
{
   CurrencyManager^ myCurrencyManager = dynamic_cast<CurrencyManager^>(this->BindingContext[ dataSource ]);
   myCurrencyManager->Refresh();
}
private void DemonstrateRefresh(){
    // Create an array with ten elements and bind to a TextBox.
    string[] myArray= new string[10];
    for(int i = 0; i <10; i++){
       myArray[i] = "item " + i;
    }
    textBox1.DataBindings.Add ("Text",myArray,"");
    // Change one value.
    myArray[0]= "New value";

    // Uncomment the next line to refresh the CurrencyManager.
    // RefreshGrid(myArray);
 }
 private void RefreshGrid(object dataSource){
    CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[dataSource];
    myCurrencyManager.Refresh();
 }
Private Sub DemonstrateRefresh()
    ' Create an array with ten elements and bind to a TextBox.
    Dim myArray(9) As String
    Dim i As Integer
    For i = 0 To 9
        myArray(i) = "item " & i
    Next i
    textBox1.DataBindings.Add("Text", myArray, "")
    ' Change one value.
    myArray(0) = "New value"

    ' Uncomment the next line to refresh the CurrencyManager.
    ' RefreshGrid(myArray);

End Sub

Private Sub RefreshGrid(dataSource As Object)
    Dim myCurrencyManager As CurrencyManager = CType(Me.BindingContext(dataSource), CurrencyManager)
    myCurrencyManager.Refresh()
End Sub

설명

Refresh 변경 시 데이터 원본이 알림을 지원하지 않는 경우 메서드를 사용합니다(예: 인 경우Array).

적용 대상

추가 정보