HeaderPane
Main
Hide
Share Link
Print

DisplayText Method, SftBox Class

Returns the text an item shows in the edit field.

Class: SftBox
Namespace: Softelvdm.SftBoxNET
Assembly: Softelvdm.SftBoxNET

Syntax

public string DisplayText( ItemClass item );
Public Function DisplayText( ByVal item As ItemClass ) As String

Parameters

item

The item, or null/Nothing.

Return Value

The text of the item's display column, its SftBox.DisplayMember value when the list is bound to a data source, or an empty string for null/Nothing.

Comments

Returns the text an item shows in the edit field.

Examples

C# View entire sample code

        private void buttonClear_Click(object sender, EventArgs e) {
            listView1.Items.Clear();
            strLastEvent = "";
            fLastEventDup = false;
        }

        // The text of the selected item, as the combo box shows it
        private string Selection(SftBox box) {
            return box.SelectedItem == null ? "none" : box.DisplayText(box.SelectedItem);
        }

        // sftBox1 - an edit field with a dropdown; typing completes the name of a fruit

        private void sftBox1_SelectedItemChanged(object sender, EventArgs e) {
            DumpValues("sftBox1.SelectedItemChanged (" + Selection(sftBox1) + ")", e);
        }

VB.NET View entire sample code

        fLastEventDup = False
    End Sub

    ' The text of the selected item, as the combo box shows it
    Private Function Selection(ByVal box As SftBox) As String
        If box.SelectedItem Is Nothing Then
            Return "none"
        End If
        Return box.DisplayText(box.SelectedItem)
    End Function

    ' SftBox1 - an edit field with a dropdown; typing completes the name of a fruit

    Private Sub SftBox1_SelectedItemChanged(ByVal sender As Object, ByVal e As EventArgs) Handles SftBox1.SelectedItemChanged
        DumpValues("SftBox1.SelectedItemChanged (" + Selection(SftBox1) + ")", e)
    End Sub

See Also SftBox Class | Classes | SftBox/NET 3.0