언어

DataObject.GetDataPresent 메서드

정의

이 DataObject 위치에 저장된 데이터가 지정된 형식과 연결되어 있는지 여부를 확인합니다.

오버로드

속성 Description
GetDataPresent(String, Boolean)

지정된 형식의 데이터가 포함되는지 또는 필요에 따라 지정된 형식으로 변환할 수 있는 데이터를 포함하는지 여부를 DataObject 결정합니다.

GetDataPresent(String)

이 DataObject 위치에 저장된 데이터가 지정된 형식과 연결되어 있는지 또는 지정된 형식으로 변환될 수 있는지 여부를 결정합니다.

GetDataPresent(Type)

이 DataObject 위치에 저장된 데이터가 지정된 형식과 연결되어 있는지 또는 지정된 형식으로 변환될 수 있는지 여부를 결정합니다.

GetDataPresent(String, Boolean)

Source:
DataObject.cs
Source:
DataObject.cs
Source:
DataObject.cs
Source:
DataObject.cs
Source:
DataObject.cs

지정된 형식의 데이터가 포함되는지 또는 필요에 따라 지정된 형식으로 변환할 수 있는 데이터를 포함하는지 여부를 DataObject 결정합니다.

public:
 virtual bool GetDataPresent(System::String ^ format, bool autoConvert);
public virtual bool GetDataPresent(string format, bool autoConvert);
abstract member GetDataPresent : string * bool -> bool
override this.GetDataPresent : string * bool -> bool
Public Overridable Function GetDataPresent (format As String, autoConvert As Boolean) As Boolean

매개 변수

format
String

확인할 형식입니다. 미리 정의된 형식은 참조 DataFormats 하세요.

autoConvert
Boolean

true 이 DataObject 형식에 저장된 데이터를 지정된 형식으로 변환할 수 있는지 여부를 확인하려면 데이터가 지정된 형식 false 인지 확인합니다.

반품

true데이터가 지정된 형식에 있거나 변환될 수 있으면 입니다. 그렇지 않으면 . false

구현

예제

다음 코드 예제에서는 현재 저장된 DataObject 데이터가 지정된 형식과 연결되어 있는지 여부를 결정합니다. 첫째, 새 DataObject 새 형식을 텍스트로 지정하여 문자열로 초기화합니다.

DataObject 그런 다음, 매개 변수를 .로 autoConvert지정하여 false 텍스트 형식과 연결된 데이터에 대해 쿼리합니다. 이 쿼리의 결과는 텍스트 상자에 인쇄됩니다.

DataObject 그런 다음, 매개 변수를 .로 autoConvert지정하여 true 문자열 형식과 연결된 데이터에 대해 쿼리합니다. 결과는 텍스트 상자에 인쇄됩니다. 이 코드를 만들려면 이 코드가 textBox1 필요합니다.

private:
   void GetIfPresent3()
   {
      // Creates a new data object using a string and the text format.
      DataObject^ myDataObject = gcnew DataObject( DataFormats::Text, "Another string" );
      
      // Prints the string in a text box with autoconvert = false.
      if ( myDataObject->GetDataPresent( "System.String", false ) )
      {
         // Prints the string in a text box.
         textBox1->Text = String::Concat(
            myDataObject->GetData( "System.String", false )->ToString(), "\n" );
      }
      else
      {
         textBox1->Text = "Could not convert data to specified format\n";
      }
      
      // Prints the string in a text box with autoconvert = true.
      textBox1->Text = String::Concat( textBox1->Text,
         "With autoconvert = true, you can convert text to string format. String is: ",
         myDataObject->GetData( "System.String", true )->ToString() );
   }
private void GetIfPresent3() {
    // Creates a new data object using a string and the text format.
    DataObject myDataObject = new DataObject(DataFormats.Text, "Another string");
 
    // Prints the string in a text box with autoconvert = false.
    if(myDataObject.GetDataPresent("System.String", false)) {
       // Prints the string in a text box.
       textBox1.Text = myDataObject.GetData("System.String", false).ToString() + '\n';
    } else
        {
            textBox1.Text = "Could not convert data to specified format" + '\n';
        }

        // Prints the string in a text box with autoconvert = true.
        textBox1.Text += "With autoconvert = true, you can convert text to string format. " +
       "String is: " + myDataObject.GetData("System.String", true).ToString();
 }
Private Sub GetIfPresent3()
    ' Creates a new data object using a string and the text format.
    Dim myDataObject As New DataObject(DataFormats.Text, "Another string")
    
    ' Prints the string in a text box with autoconvert = false.
    If myDataObject.GetDataPresent("System.String", False) Then
        ' Prints the string in a text box.
        textBox1.Text = myDataObject.GetData("System.String", False).ToString() & ControlChars.Cr
    Else
        textBox1.Text = "Could not convert data to specified format" & ControlChars.Cr
    End If 
    ' Prints the string in a text box with autoconvert = true.
    textBox1.Text &= "With autoconvert = true, you can convert text to string format. " & _
                    "String is: " & myDataObject.GetData("System.String", True).ToString()
End Sub

설명

이 메서드를 호출하여 호출 GetData하기 전에 형식이 있는지 여부를 확인합니다. 이 GetFormats형식에서 사용할 수 있는 형식을 호출 DataObject 합니다.

이 메서드는 다음과 같은 경우를 반환합니다 true .

  • autoConvert 매개 변수이며 true 데이터는 적절한 형식으로 변환할 수 있는 형식입니다.

  • autoConvert 매개 변수가 false 있고 데이터가 적절한 형식입니다.

이 메서드는 다음과 같은 경우를 반환합니다 false .

  • autoConvert 매개 변수이며 true 이 메서드는 지정된 형식의 데이터를 찾을 수 없으며 데이터를 지정된 형식으로 변환할 수 없거나 데이터가 자동 변환 집합false으로 저장되었습니다.

  • autoConvert 매개 변수가 있고 false 지정된 형식의 DataObject 데이터가 존재하지 않습니다.

메모

변환이 허용되도록 지정하고 요청된 형식이 저장된 형식과 호환되는 경우 데이터를 저장한 경우 다른 형식으로 변환할 수 있습니다. 예를 들어 유니코드로 저장된 데이터를 텍스트로 변환할 수 있습니다.

메모

데이터를 검색할 수 없는 경우 예외가 throw되지 않습니다. 대신 반환 false 됩니다.

참고 항목

적용 대상

GetDataPresent(String)

Source:
DataObject.cs
Source:
DataObject.cs
Source:
DataObject.cs
Source:
DataObject.cs
Source:
DataObject.cs

이 DataObject 위치에 저장된 데이터가 지정된 형식과 연결되어 있는지 또는 지정된 형식으로 변환될 수 있는지 여부를 결정합니다.

public:
 virtual bool GetDataPresent(System::String ^ format);
public virtual bool GetDataPresent(string format);
abstract member GetDataPresent : string -> bool
override this.GetDataPresent : string -> bool
Public Overridable Function GetDataPresent (format As String) As Boolean

매개 변수

format
String

확인할 형식입니다. 미리 정의된 형식은 참조 DataFormats 하세요.

반품

true 이 위치에 저장된 데이터가 지정된 형식과 연결되었거나 지정된 형식으로 변환될 수 있으면 이 DataObject 고, false그렇지 않으면 .

구현

예제

다음 코드 예제에서는 현재 저장된 DataObject 데이터가 지정된 형식과 연결되어 있는지 또는 변환될 수 있는지를 결정합니다. 새 DataObject 문자열과 연결된 형식이 텍스트로 지정되어 초기화됩니다.

그런 다음 예제에서는 텍스트 데이터가 에 DataObject있는지 여부를 출력합니다. 이 코드를 만들려면 이 코드가 textBox1 필요합니다.

설명

이 메서드를 호출하여 호출 GetData하기 전에 형식이 있는지 여부를 확인합니다. 이 GetFormats형식에서 사용할 수 있는 형식을 호출 DataObject 합니다.

메모

변환이 허용되도록 지정하고 요청된 형식이 저장된 형식과 호환되는 경우 데이터를 다른 형식으로 변환할 수 있습니다. 예를 들어 유니코드로 저장된 데이터를 텍스트로 변환할 수 있습니다.

메모

데이터를 검색할 수 없는 경우 예외가 throw되지 않습니다. 대신 반환 false 됩니다.

참고 항목

적용 대상

GetDataPresent(Type)

Source:
DataObject.cs
Source:
DataObject.cs
Source:
DataObject.cs
Source:
DataObject.cs
Source:
DataObject.cs

이 DataObject 위치에 저장된 데이터가 지정된 형식과 연결되어 있는지 또는 지정된 형식으로 변환될 수 있는지 여부를 결정합니다.

public:
 virtual bool GetDataPresent(Type ^ format);
public virtual bool GetDataPresent(Type format);
abstract member GetDataPresent : Type -> bool
override this.GetDataPresent : Type -> bool
Public Overridable Function GetDataPresent (format As Type) As Boolean

매개 변수

format
Type

Type 확인할 형식을 나타내는 형식입니다.

반품

true 이 위치에 저장된 데이터가 지정된 형식과 연결되었거나 지정된 형식으로 변환될 수 있으면 이 DataObject 고, false그렇지 않으면 .

구현

예제

다음 코드 예제에서는 지정된 형식의 데이터가 있는지 DataObject또는 데이터를 지정된 형식으로 변환할 수 있는지 여부를 결정합니다. 결과는 텍스트 상자에 표시됩니다. 코드를 만들려면 코드가 textBox1 필요합니다.

private:
   void GetIfPresent2()
   {
      // Creates a component to store in the data object.
      Component^ myComponent = gcnew Component;
      
      // Creates a new data object and assigns it the component.
      DataObject^ myDataObject = gcnew DataObject( myComponent );
      
      // Creates a type to store the type of data.
      Type^ myType = myComponent->GetType();
      
      // Determines if the DataObject has data of the Type format.
      textBox1->Text = String::Concat( "Is the specified data type available ",
         "in the DataObject? ", myDataObject->GetDataPresent( myType ), "\n" );
      
      // Retrieves the data using its type format, and displays the type.
      Object^ myObject = myDataObject->GetData( myType );
      textBox1->Text = String::Concat( textBox1->Text, "The data type stored ",
         "in the DataObject is: ", myObject->GetType()->Name );
   }
private void GetIfPresent2() {
    // Creates a component to store in the data object.
    Component myComponent = new Component();
 
    // Creates a new data object and assigns it the component.
    DataObject myDataObject = new DataObject(myComponent);
 
    // Creates a type to store the type of data.
    Type myType = myComponent.GetType();
 
    // Determines if the DataObject has data of the Type format.
    textBox1.Text = "Is the specified data type available in the " +
       "DataObject? " + myDataObject.GetDataPresent(myType).ToString() + '\n';
 
    // Retrieves the data using its type format, and displays the type.
    Object myObject = myDataObject.GetData(myType);
    textBox1.Text += "The data type stored in the DataObject is: " +
       myObject.GetType().Name;
 }
Private Sub GetIfPresent2()
    ' Creates a component to store in the data object.
    Dim myComponent As New Component()
    
    ' Creates a new data object and assigns it the component.
    Dim myDataObject As New DataObject(myComponent)
    
    ' Creates a type to store the type of data.
    Dim myType As Type = myComponent.GetType()
    
    ' Determines if the DataObject has data of the Type format.
    textBox1.Text = "Is the specified data type available in the " & "DataObject? " & _
        myDataObject.GetDataPresent(myType).ToString() & ControlChars.Cr
    
    ' Retrieves the data using its type format, and displays the type.
    Dim myObject As Object = myDataObject.GetData(myType)
    textBox1.Text += "The data type stored in the DataObject is: " + myObject.GetType().Name
End Sub

설명

이 메서드를 호출하여 호출 GetData하기 전에 형식이 있는지 여부를 확인합니다. 이 GetFormats형식에서 사용할 수 있는 형식을 호출 DataObject 합니다.

메모

변환이 허용되도록 지정하고 요청된 형식이 저장된 형식과 호환되는 경우 데이터를 다른 형식으로 변환할 수 있습니다. 예를 들어 유니코드로 저장된 데이터를 텍스트로 변환할 수 있습니다.

메모

데이터를 검색할 수 없는 경우 예외가 throw되지 않습니다. 대신 반환 false 됩니다.

참고 항목

적용 대상