June 1, 2002

Adding styles to the font of the selected text of a RichTextBox

‘ Add a style to the selection of a RichTextBox,’ without deleting the current styles that may be already’ present in the selection or in portions of it” Example: AddFontStyle(richTextBox1, FontStyle.Bold)Public Sub AddFontStyle(ByVal rtb As RichTextBox, _ ByVal style As System.Drawing.FontStyle) ‘ if the selection length is > 0, work

Removing styles from the font of the selected text of a RichTextBox

‘ Remove a style from the selection of a RichTextBox’ Example: RemoveFontStyle(richTextBox1, FontStyle.Bold)Public Sub RemoveFontStyle(ByVal rtb As RichTextBox, _ ByVal style As System.Drawing.FontStyle) ‘ if the selection length is > 0, work char by char. ‘ This is necessary because the selected text may have different ‘ styles in different

Copying the selected text of a RichTextBox text into the Clipboard

‘ Copy the RichTextBox’s selected text into the Clipboard’ Example: CopyFromRichTextBox (richTextBox1)Public Sub CopyFromRichTextBox(ByVal rtb As RichTextBox, _ Optional ByVal availableAfterEnd As Boolean = False) Dim data As New DataObject() ‘ get the selected RTF text if there is a selection, ‘ or the entire text is no text is

Setting the font family of the selected text of a RichTextBox

‘ Set the specified font to the selection of a RichTextBox’ Note: require GetSafeStyleForFontFamily” Example: SetFontFamily(richTextBox1, “Times New Roman”)Public Sub SetFontFamily(ByVal rtb As RichTextBox, ByVal fontName As String) Dim fontFam As New System.Drawing.FontFamily(fontName) Dim style As System.Drawing.FontStyle ‘ if the selection length is > 0, work char by char If

Pasting the text in the Clipboard into a RichTextBox

‘ Paste the text currently in the Clipboard into the specified RichTextBox’ Example: PasteIntoRichTextBox (richTextBox1)Public Sub PasteIntoRichTextBox(ByVal rtb As RichTextBox) ‘ get the data currently in the Clipboard Dim data As IDataObject = Clipboard.GetDataObject() ‘ check whether there is any data in RTF format, ‘ without attempting a conversion If

Setting the font size of the selected text of a RichTextBox

‘ Set the specified font size to the selection of a RichTextBox’ Example: SetFontSize(richTextBox1, 16)Public Sub SetFontSize(ByVal rtb As RichTextBox, ByVal fontSize As Single) ‘ if the selection length is > 0, work char by char If rtb.SelectionLength > 0 Then Dim selStart As Integer = rtb.SelectionStart Dim selLength As

Cross Language Barriers with SOAP and a Java Web Service

he Web services programming model is breaking down the barriers of cross-platform and cross-language communications. Because it works through simple XML-formatted text messages, code written in any language should be able to interact with code written in any other language, on any platform, anywhere. That sounds good in theory, but