我在vb中画了一个文本框控件Text1,要用一个标签Lable1来显示所选文字的起始位置和Lable2来显示所选文字的长

1个回答

  • Private Sub Text1_KeyUp(KeyCode As Integer,Shift As Integer)

    '检测用键盘来选择文字的情况

    Label1.Caption = "所选文字的起始位置:" & Text1.SelStart

    Label2.Caption = "所选文字的长度:" & Text1.SelLength

    End Sub

    Private Sub Text1_MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Single)

    '检测用鼠标来选择文字的情况

    Text1_KeyUp 0,0

    End Sub

    Private Sub Command1_Click()

    '退出程序

    End

    End Su