ComboBox.Select(Int32, Int32) 方法

定義

ComboBox 的可編輯部分中選取某個範圍的文字。

public:
 void Select(int start, int length);
public void Select (int start, int length);
override this.Select : int * int -> unit
Public Sub Select (start As Integer, length As Integer)

參數

start
Int32

文字方塊中目前的文字選取範圍中第一個字元的位置。

length
Int32

要選取的字元數。

例外狀況

start 小於零。

-或- start 加上 length 小於零。

備註

如果您想要將開始位置設定為控制項文字中的第一個字元,請將 start 參數設定為零。 您可以使用這個方法來選取文字的子字串,例如在搜尋控制項的文字並取代資訊時。

注意

SelectionStart 會傳回目前選取範圍的較低值。 例如, Select(10, -4) 從字元位置 6 到字元位置 10 選取文字。 如果您現在取得 SelectionStart 值,它將會是 6,而不是 10。

適用於

另請參閱