Freigeben über


XmlMappedRange.AutoComplete(String) Method

Definition

Gets an AutoComplete match from the list.

public:
 System::String ^ AutoComplete(System::String ^ String);
public string AutoComplete (string String);
abstract member AutoComplete : string -> string
Public Function AutoComplete (String As String) As String

Parameters

String
String

The string to complete.

Returns

An AutoComplete match from the list.

Examples

The following code example enters the string "Smith" into cell B1, and then uses the AutoComplete method to find an AutoComplete match for the string "Smi". This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell. The AutoComplete match will be found if CustomerLastNameCell is in cell B2.

private void DisplayAutoCompleteResult()
{
    this.Range["B1", missing].Value2 = "Smith";
    string autoString = this.CustomerLastNameCell.AutoComplete("Smi");

    if (String.IsNullOrEmpty(autoString))
    {
        MessageBox.Show("No AutoComplete results were found.");
    }
    else
    {
        this.CustomerLastNameCell.Value2 = autoString;
    }
}
Private Sub DisplayAutoCompleteResult()
    Me.Range("B1").Value2 = "Smith"
    Dim autoString As String = Me.CustomerLastNameCell.AutoComplete("Smi")

    If String.IsNullOrEmpty(autoString) Then
        MsgBox("No AutoComplete results were found.")
    Else
        Me.CustomerLastNameCell.Value2 = autoString
    End If
End Sub

Remarks

If there is no AutoComplete match or if more than one entry in the list matches the string to complete, this method returns an empty string.

This method works even if the AutoComplete feature is disabled.

Applies to