Form load code
Private Sub Form_Load()
On Error Resume Next
' Add the tab stops
For i = 0 To frmMain.txtText.SelTabCount - 1
' Add the item to the list box
cboTabs.AddItem CInt((frmMain.txtText.SelTabs(i) * 100) / 100#)
Next
cboTabs.ListIndex = 0
End Sub
' Add tab code
Public Sub cmdAdd_Click()
Dim gItemFound As Boolean
gItemFound = False
' Add new value
For i = 0 To cboTabs.ListCount - 1
' Is the current item more than
' new one?
If Val(cboTabs.List(i)) > Val(cboTabs.Text) Then
' Yes it is, add the new
' item here
cboTabs.AddItem cboTabs.Text, i
' select this item
cboTabs.ListIndex = i
' we have put it in
gItemFound = True
Exit For
End If
Next
If gItemFound = False Then
' No item found that is greater
' put the new item at bottom
cboTabs.AddItem cboTabs.Text, cboTabs.ListCount
' select the item
cboTabs.ListIndex = cboTabs.ListCount - 1
End If
End Sub
' Remove tab code
Private Sub cmdRemove_Click()
' Are you sure?
If MsgBox("Remove current tab stop?", vbYesNo + vbExclamation) = vbNo Then Exit Sub
cboTabs.RemoveItem (cboTabs.ListIndex)
End Sub
' OK code
Public Sub cmdOK_Click()
' Update sel tabs
frmMain.txtText.SelTabCount = cboTabs.ListCount
For i = 0 To cboTabs.ListCount - 1
' Add the sel tab
frmMain.txtText.SelTabs(i) = cboTabs.List(i)
Next
Unload Me
End Sub