Rich Text Box Control and Pasting the Clipboard

Visual Basic


  • 1. Using Drag and Drop between controls
    I am trying to create a form that (at least) contains a treeview (holding hierarchical information about school departments and programs of study) and a listbox holding details of a teacher's 'classes'. What I want to do is to be able to select a 'program of study' and drag in onto a particular 'class' in the listbox. In code I will then allocate that class to that program of study. My problem is figuring out how to detect which listbox entry I am dropping my object onto! Is there a (hopefully) simple way to detect (and highlight) which list entry is under the mouse / drag icon? Your help is (as ever) greatly appreciated (and desperatley needed!) Regards -- UK John
  • 2. VB6 combobox data binding
    Databinding is not working!!! Theres a combobox and an adodb.recordset. Stting up the recordset, then attaching it to the combobox. the recordset has records that are not showing up in the combobox. I do not want to use databinding if I cannot use a programmatically created adodb.recordset as a datasource. so, if I have to, I will loop the damn thing - but I want to make sure databinding cannot be done with a recordset before I do that. Heres the forsaken code: (connection established elsewhere - and is opened, and is ok) Dim sSql As String Dim rs as Adodb.Recordset sSql = "SELECT Field1, Field2 FROM MyTable" Set rs = New ADODB.Recordset With rs .CursorLocation = adUseClient .LockType = adLockOptimistic .CursorType = adOpenKeyset .Open sSql, cnSQL End With Set CbBox.DataSource = rs CbBox.DataField = "Field1" CbBox.ListIndex = 0 '<<Dies here: "Invalid Property Value" 'in addition, looking at the 'ListCount' property gives ZERO Can anyone see anything that might be missing? TIA Eric
  • 3. ComboBox - how to find and select a list item
    Hi, I have this control that i want to set to a default value. Say: cmbCodeSelect as ComboBox ... For iLoop = 1 To Me.cmbCodeSelect.ListCount If cTransport = Me.cmbCodeSelect.Recordset.Fields(1) Then Me.cmbCodeSelect.Value = iLoop Exit For End If Next iLoop ... This goes well if cTransport = available in the first row, as it seems to be accessible by the "RecordSet" property of the ComboBox object. But: how to go through the other listitems? Hans.
  • 4. Available - Selected datagrids
    I'm working on a form where users are presented a list of parts displayd in a datagrid. After selecting a part or a number of parts they click a button (i.e. > or >>) and move the selected part(s) from the Available datagrid to the Selected datagrid. The selected part will no longer appear in the Available datagrid. I have been searching for a document that walks through setting u such a form. I have not been able to find anything. Can anyone tell me where I can find such a document? Thanks in advance -- Tony

Rich Text Box Control and Pasting the Clipboard

Postby Jimmy Jam » Fri, 21 Nov 2003 13:13:00 GMT

I am trying to preserve formatting when pasting rich text from the clipboard
to a rich text box control.
Something I noticed is that consecutive spaces in a sentence (like after a
period at the end of a sentence)
is not preserved - it is pasted as a single space.

When I paste the text to note pad, the double spaces are there.

Any ideas of a work around?

Thanks in advance!

Similar Threads:

1.Using ClipBoard With Rich Text Box

I find the use of the ClipBoard in conjunction with a Rich Text Box to
be elusive.

If I use the following instruction to perform a Copy function it will
paste properly into the same or another Rich Text Box and MS Word.
But, it won't paste into Notepad (or another text editor), and the
ClipBoard Viewer reports, "ClipBook Viewer cannot display the
information in its current format."

        Clipboard.SetText rtxtDoc.SelRTF, vbCFRTF

On the other hand if I use the following instruction to do the Copy it
pastes into all locations and is displayed in the ClipBoard Viewer
but, naturally, all the rich formatting is lost.  That is, it pastes
as plain text.

        Clipboard.SetText rtxtDoc.SelText

If I use Ctrl-C to do the copy it works properly under all conditions.

How do I Copy to the ClipBoard from a Rich Text Box such that it works
under all conditions like Ctrl-C?

using VB5

2.Rich Text Box - Pasting

I'm using the Rich Text Box control because I want to allow the user to use 
Bold font, Italics, underlines etc.  However, I would like to prevent the 
user from changing the font and font size.  At the moment the user an Paste 
in some text by doing Ctrl+V which can have a mixture of fonts.

Is is possible without seeing any flickering on the screen to be able to set 
the font and font size of whatever is pasted in to be the font and size I 


3.Printing Rich Text from Rich Text Box v6.0

This is supposed to work but it doesn't:

RichTextBox.SelPrint (Printer.hDC)

Yes, I've initialized the printer.  Yes, I've experimented 
with selecting none, all and some of the rich text.  Yes, 
I've made a simple experimental program to see if the 
problem was coming from elsewhere.

As soon as the command to print the rich text executes it 
creates a printer error that crashes SPOOLSV.EXE requiring 
a reboot to get the printers back.  I've tried this to 
different printers (parallel & USB) and while the sequence 
of errors is a bit different, all wind up with the same 
final result of crashing SPOOLSV.EXE

No problem printing the "plain" text from the rich text 
box--no problem printing the rich text encoding (.textRTF)-
-no problem printing anything else by other methods to the 
4 different printers on this system.

Printer to be used for this function is an HP Laserjet 
(parallel connection).  Other sections of my program have 
no problem controlling the printer to include duplexing, 
text justification, envelopes, etc.

It seems senseless for me to have to write code to print 
actual rich text coding when the function is supposed to 
be built-in!!!!!

No, I don't want to output this to Word.  It is for form 
letters in my database (NOT a commercial database--I don't 
like them as their verification and security are 
lacking).  I have no problem printing the letterhead (text 
& graphics) portion of the letter through other means--I 
just want the Rich Text to print like it is supposed to 



4.Formatting Text in Rich Text Box Control

I have a rich textbox control and a long string of characters that I
will assign to it's .text property. How can I bold some characters and
apply italics to others?

5.Remote control excel - copy range of cells to clipboard for pasting into a text form

I have written an application that remotely controls Microsoft Excel
2000 from VB .NET

I can successfully update cells, formulas etc. I can also select a
range of cells on the spreadsheet from Excel.

The one problem I am having is actually getting Excel to copy the
cells to the clipboard for repasting into Notepad.

Whenever I attempt to do the copy I end up with a new worksheet which
is NOT what I want.

The last piece is that when closing down the program I will want to
clear the clipboard as well before telling Excel to exit.

Does anyone have any ideas on how I can automate this? Ideas are
appreciated. Sample code is even more appreciated.

~Jamie N

6. Embedding file in Rich Text Box control

7. Set Rich Text Box Control Margin

8. Left and Right margine in Rich Text Box control

Return to Visual Basic


Who is online

Users browsing this forum: No registered users and 23 guest