|
-
Apr 19th, 2004, 12:29 PM
#1
Thread Starter
Junior Member
Please help me use multiple documents in my program...
Okay, I'm writing a word processing program aimed at writers, with all the stuff that my writer-type friends want in it. Problem is, I can't get it to use multiple documents. I have it creating them, and I can make it save whatever document you're on and all that, but there is one thing I can't do.
Word count on the currently selected document every time you hit space.
I'm using KeyPreview = True to watch for any space press, and I have that working. The only thing is getting it to word count on whatever document is currently active. Here is my current code, please tell me if I'm at least on the right track or not:
VB Code:
Protected Overrides Function ProcessKeyPreview(ByRef m As System.Windows.Forms.Message) As Boolean
'If space key is pressed
If m.WParam.ToInt32 = 32 Then
'Dim Number as whatever tab number we're on.
Dim Number As Integer = TabControl1.SelectedIndex + 1
'Dim WhatOne as whatever RichTextBoxEx we want to count, if we're on the first tab then this will make WhatOne = RichTextBoxEx1
Dim WhatOne As String = "RichTextBoxEx" + Number.ToString
'Dim WhatToCount as a new control so that we can count its text.
Dim WhatToCount As New RichTextBoxEx
'Change WhatToCounts name to whatever RichTextBox we're on, so if we're on the first tab then its new name will be RichTextBoxEx1
WhatToCount.Name = WhatOne
'Count WhatToCounts text
Word_Counter(WhatToCount.Text)
End If
End Function
Word_Counter is a self-made function that will count the words in whatever string you specify. It doesn't work. Any idea as to how I can fix this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|