-
Ok I was wodering in a richtextbox how would I go about trapping the tab key? When I hit tab it changes focus and I even tried richtextboxes little tab thing set it to false or true and it doesnt work so I tried to capture the keyascii for tab key convert it into spaces and then set keyascii to 0 but still no go .. I need some help here.
Second question is I have a sub menu under documents and I want it to view the recent documents folder but I dunno how to get all the contents of a folder into an array or anything like that. If I could get some help on that thanks.
-
1) You could Disable the TabStop Property of all Controls on the Form, this would Force the RTFBox to use Tabs as Indents, then Reenable the TabStops on the LostFocus Event, ie.
Code:
Private Sub RichTextBox1_GotFocus()
Dim oCTRL As Control
On Error Resume Next
For Each oCTRL In Me
oCTRL.TabStop = False
Next
End Sub
Private Sub RichTextBox1_LostFocus()
Dim oCTRL As Control
On Error Resume Next
For Each oCTRL In Me
oCTRL.TabStop = True
Next
End Sub
2) Create a SubMenuItem off of your Documents Menu Called; mnuDocs and set it's Caption to {No Documents}, set its Enabled Property to False and its Index Property to 0(Zero).
Code:
Private Sub Command1_Click()
Dim sDir As String
Dim iFile As Integer
sDir = Dir("C:\Files\*.txt")
While Len(sDir)
If iFile Then Load mnuDocs(iFile)
mnuDocs(iFile).Caption = sDir
mnuDocs(iFile).Visible = True
mnuDocs(iFile).Enabled = True
iFile = iFile + 1
sDir = Dir
Wend
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]