다음을 통해 공유


ControlCollection.Remove 메서드 (String)

ControlCollection 인스턴스에서 지정된 컨트롤을 제거합니다.

네임스페이스:  Microsoft.Office.Tools.Word
어셈블리:  Microsoft.Office.Tools.Word(Microsoft.Office.Tools.Word.dll)

구문

‘선언
Function Remove ( _
    name As String _
) As Boolean
bool Remove(
    string name
)

매개 변수

반환 값

형식: System.Boolean
Boolean 를 반환합니다.

설명

디자인 타임에 추가된 컨트롤은 ControlCollection 인스턴스에서 제거할 수 없습니다.Remove 메서드는 런타임에 추가된 컨트롤을 제거하는 데만 사용할 수 있습니다.

예제

다음 코드 예제에서는 Button 컨트롤과 MonthCalendar 컨트롤을 문서에 추가한 다음 Button 컨트롤을 제거합니다.

Private Sub WordControlRemove()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Button1 As Microsoft.Office.Tools.Word.Controls.Button _
        = Me.Controls.AddButton(0, 0, 56.25F, 17.25F, "Button1")
    Dim MonthCalendar1 As Microsoft.Office.Tools.Word.Controls. _
        MonthCalendar = Me.Controls.AddMonthCalendar(0, 20, _
        75, 15, "MonthCalendar1")
    Me.Controls.Remove("Button1")
End Sub 
private void WordControlRemove()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Controls.Button button1 =
        this.Controls.AddButton(0, 0, 56.25F, 17.25F,
        "button1");
    Microsoft.Office.Tools.Word.Controls.MonthCalendar
         monthCalendar1 = this.Controls.AddMonthCalendar(
         0, 20, 75, 15, "monthCalendar1");
    this.Controls.Remove("button1");
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

ControlCollection 인터페이스

Remove 오버로드

Microsoft.Office.Tools.Word 네임스페이스