[VB6] การทำไฮไลท์หรือแถบแสงใน TextBox Control
http://www.g2gnet.com/webboard/images/vb6/hightlight.pngเวลาที่ TextBox ถูกโฟกัส (Focus) เราจะทำแถบแสงเพื่อเลือกข้อความทั้งหมดที่อยู่ใน TextBox ...
Option Explicit
Private Sub Form_Load()
Text1.Text = "Hello, World. G2GNet.Com"
End Sub
'// โปรแกรมย่อยในการทำ High Light ใน TextBox ... ใช้ร่วมกับ GotFocus
Private Sub HLText(ByRef sText)
On Error Resume Next
With sText
.SelStart = 0
.SelLength = Len(sText.Text)
End With
End Sub
Private Sub Text1_GotFocus()
'// Reference Text1
Call HLText(Text1)
End Sub
หน้า:
[1]