NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataObject.GetDataPresent

Determines whether data stored in this instance is associated with the specified format.

Overload List

Determines whether data stored in this instance is associated with, or can be converted to, the specified format.

[Visual Basic] Overloads Overridable Public Function GetDataPresent(String) As Boolean
[C#] public virtual bool GetDataPresent(String);
[C++] public: virtual bool GetDataPresent(String*);
[JScript] public function GetDataPresent(String) : Boolean;

Determines whether data stored in this instance is associated with, or can be converted to, the specified format.

[Visual Basic] Overloads Overridable Public Function GetDataPresent(Type) As Boolean
[C#] public virtual bool GetDataPresent(Type);
[C++] public: virtual bool GetDataPresent(Type*);
[JScript] public function GetDataPresent(Type) : Boolean;

Determines whether data stored in this instance is associated with the specified format, using autoConvert to determine whether to convert the data to the format.

[Visual Basic] Overloads Overridable Public Function GetDataPresent(String, Boolean) As Boolean
[C#] public virtual bool GetDataPresent(String, bool);
[C++] public: virtual bool GetDataPresent(String*, bool);
[JScript] public function GetDataPresent(String, Boolean) : Boolean;

Example

The following example determines whether data currently stored in this Object is associated with a specified format. First, a new instance of DataObject is initialized with a string, specifying its associated format as text. Then the DataObject is queried for data associated with the text format, specifying autoConvert false. The result of this query is true. Then the DataObject is queried for data associated with unicode format, specifying autoConvert false. Text can be converted to unicode but, because conversion is not allowed, the result of this query is false. This code assumes Button1 has been instantiated.

Note   This example shows how to use one of the overloaded versions of GetDataPresent. For other examples that may be available, see the individual overload topics.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
   ' Declare a DataObject.
   Dim data1 As DataObject
   ' Define a string.
   Dim textString1 As String  = "My text string"
   ' Define a boolean to hold the query results.
   Dim isFormat As Boolean
   ' Create a new DataObject containing the text string whose associated format is specified as text.
   Set data1 = New DataObject(DataFormats.Text, textString1)
   ' Query the DataObject for text format, specifying no conversion.
   isFormat = data1.GetDataPresent(DataFormats.Text, false)
   ' And display the result of the query.
   messagebox.Show "Data associated with text format was found: " & isFormat
   ' Now query for unicode format, specifying no conversion.
   isFormat = data1.GetDataPresent(DataFormats.UnicodeText, false)
   ' And display the result of the query.
   MessageBox.Show "Data associated with unicode format was found: " & isFormat
End Sub

See Also

DataObject Class | DataObject Members | System.WinForms Namespace