Click here to Skip to main content
15,921,210 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: directory write access denied. Pin
Dave Kreskowiak16-Mar-06 3:44
mveDave Kreskowiak16-Mar-06 3:44 
GeneralRe: directory write access denied. Pin
uglyeyes16-Mar-06 20:32
uglyeyes16-Mar-06 20:32 
GeneralRe: directory write access denied. Pin
Dave Kreskowiak17-Mar-06 1:32
mveDave Kreskowiak17-Mar-06 1:32 
GeneralRe: directory write access denied. Pin
uglyeyes17-Mar-06 2:32
uglyeyes17-Mar-06 2:32 
GeneralRe: directory write access denied. Pin
uglyeyes17-Mar-06 2:41
uglyeyes17-Mar-06 2:41 
QuestionScanning text one word at a time Pin
Robert199915-Mar-06 15:15
Robert199915-Mar-06 15:15 
AnswerRe: Scanning text one word at a time Pin
CWIZO16-Mar-06 2:30
CWIZO16-Mar-06 2:30 
AnswerRe: Scanning text one word at a time Pin
progload16-Mar-06 7:00
progload16-Mar-06 7:00 
Robert1999,

Give this a try, for your son..

Should get you started...

'---------------------------------------------------------------------

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox
Friend WithEvents RichTextBox2 As System.Windows.Forms.RichTextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.RichTextBox1 = New System.Windows.Forms.RichTextBox
Me.RichTextBox2 = New System.Windows.Forms.RichTextBox
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(205, 15)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(65, 25)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'RichTextBox1
'
Me.RichTextBox1.Location = New System.Drawing.Point(10, 65)
Me.RichTextBox1.Name = "RichTextBox1"
Me.RichTextBox1.Size = New System.Drawing.Size(265, 50)
Me.RichTextBox1.TabIndex = 1
Me.RichTextBox1.Text = "This is an example of finding text in a rich text box"
'
'RichTextBox2
'
Me.RichTextBox2.Location = New System.Drawing.Point(10, 130)
Me.RichTextBox2.Name = "RichTextBox2"
Me.RichTextBox2.Size = New System.Drawing.Size(265, 105)
Me.RichTextBox2.TabIndex = 2
Me.RichTextBox2.Text = "RichTextBox2"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.RichTextBox2)
Me.Controls.Add(Me.RichTextBox1)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region


Private normalFont As New Font("Times New Roman", 12)
Private errorFont As New Font("Times New Roman", 12, FontStyle.Bold)
Private bigFont As New Font("Times New Roman", 48, FontStyle.Bold)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
test()
End Sub

Private Function test()
Try
' Return all text to normal since
' underlined spaces might be left behind
RichTextBox1.SelectionStart = 0
RichTextBox1.SelectionLength = RichTextBox1.Text.Length
RichTextBox1.SelectionFont = normalFont
RichTextBox1.SelectionColor = Color.Black
' Beginning location in the RichTextBox of the next word to check
Dim index As Integer = 0

' Enumerate over the collection of words obtained from String.Split
Dim s As String
For Each s In RichTextBox1.Text.Split(Nothing)
' Select the word
RichTextBox1.SelectionStart = index
RichTextBox1.SelectionLength = s.Length

' Trim off any ending punctuation in the selected text
While RichTextBox1.SelectionLength > 0 And Char.IsPunctuation(RichTextBox1.Text.Chars(index + RichTextBox1.SelectionLength - 1))
RichTextBox1.SelectionLength -= 1
End While

' put it in the second richtextbox
RichTextBox2.Font = bigFont
RichTextBox2.Text = RichTextBox1.SelectedText

' change the text to red in the first richtextbox
RichTextBox1.SelectionFont = errorFont
RichTextBox1.SelectionColor = Color.Red

' Update to point to the character after the current word
index = index + s.Length + 1

Application.DoEvents()

' 2000 = Two seconds
System.Threading.Thread.Sleep(2000)

Next
Catch ex As Exception
' do something with an error here
End Try

End Function

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RichTextBox1.Font = normalFont
RichTextBox1.Text = "This is an example of finding text in a rich text box"
RichTextBox2.Text = ""
End Sub
End Class

'------------------------------------------------------------

progload



QuestionTooltip on Comboboxes Pin
Bag-oSaVB15-Mar-06 14:49
Bag-oSaVB15-Mar-06 14:49 
AnswerRe: Tooltip on Comboboxes Pin
Dave Kreskowiak16-Mar-06 4:01
mveDave Kreskowiak16-Mar-06 4:01 
QuestionUsing SQL Express from Visual Basic 6 Pin
Chandana Subasinghe15-Mar-06 13:12
Chandana Subasinghe15-Mar-06 13:12 
QuestionDocumentation to use flash8.ocx in vb.net windows forms Pin
MAP Tiger15-Mar-06 6:56
MAP Tiger15-Mar-06 6:56 
AnswerRe: Documentation to use flash8.ocx in vb.net windows forms Pin
Chatura Dilan15-Mar-06 14:45
Chatura Dilan15-Mar-06 14:45 
QuestionRe: Documentation to use flash8.ocx in vb.net windows forms Pin
MAP Tiger15-Mar-06 22:49
MAP Tiger15-Mar-06 22:49 
QuestionHow to create optional text boxes Pin
isjerelijah15-Mar-06 6:43
isjerelijah15-Mar-06 6:43 
AnswerRe: How to create optional text boxes Pin
noshaba mariam15-Mar-06 17:29
noshaba mariam15-Mar-06 17:29 
QuestionFind/Replace Text in Binary Files Pin
Zenly15-Mar-06 5:14
Zenly15-Mar-06 5:14 
QuestionClosing Javascript Error Message Pin
captain_zep15-Mar-06 4:41
captain_zep15-Mar-06 4:41 
QuestionMultimedia control error?? Pin
campbells15-Mar-06 3:29
campbells15-Mar-06 3:29 
AnswerRe: Multimedia control error?? Pin
Dave Kreskowiak15-Mar-06 5:53
mveDave Kreskowiak15-Mar-06 5:53 
GeneralRe: Multimedia control error?? Pin
campbells15-Mar-06 6:13
campbells15-Mar-06 6:13 
QuestionClass Good Practices? Pin
Kaditcher15-Mar-06 2:46
Kaditcher15-Mar-06 2:46 
AnswerRe: Class Good Practices? Pin
Guffa15-Mar-06 3:59
Guffa15-Mar-06 3:59 
Questionhow to play flash??? Pin
campbells15-Mar-06 2:46
campbells15-Mar-06 2:46 
AnswerRe: how to play flash??? Pin
Chatura Dilan15-Mar-06 14:43
Chatura Dilan15-Mar-06 14:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.