By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,996 Members | 884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,996 IT Pros & Developers. It's quick & easy.

Adding textbox to rtb in vb 6

P: 15
I am designing an editor program using rich text box in vb 6.0. I want to add a special box for entering verse or poems so that when I click a button, this box is placed at current position of cursor e-g if cursor is at line#3, the box is placed at line#3 and focus is changed from rtb to box. And after entering text in this box, when i click rtb, focus is changed from box to rtb, also cursor is placed below this box. Also I want that when I save the document, this box is also saved with. I have tried adding text box to accomplish these tasks but i am having problem setting position of textbox, setting focus and position of cursor. Also I dont think it can be saved with document. Is there a way to accomplish this by adding some box to rtb?
Dec 6 '08 #1
Share this Question
Share on Google+
5 Replies


Dököll
Expert 100+
P: 2,364
Are you asking about a floating textbox... This sounds pretty interesting. Can you break it down a bit?

I know SelText can set focus on a certain, designated text. I suspect you'll need to use that in your code. As far as movement, perhaps you can write a function to control position of the textbox, which would then allow you to move it.

If I see anything, I'll post ...

In a bit!
Dec 13 '08 #2

QVeen72
Expert 100+
P: 1,445
Hi,

Try This Code:

Expand|Select|Wrap|Line Numbers
  1. Dim MyStr As String
  2. Dim TotRTF As String
  3. Dim MyText As String
  4. MyText = "MY TEXT BOX"
  5. MyStr = "\par \trowd\trgaph108\trleft36\cellx1636\pard\intbl "
  6. MyStr = MyStr & MyText & "\cell\row\pard\par"
  7. With RTB
  8.     .SelText = Chr(&H80)
  9.     TotRTF = .TextRTF
  10.     TotRTF = Replace(.TextRTF, "\'80", MyStr)
  11.     .TextRTF = TotRTF
  12. End With
  13.  
Regards
Veena
Dec 15 '08 #3

P: 15
Hi Veena, Sorry for late reply. I hav tried this code but its not working. I hav added this code to the menu entry "Add TextBox". When i click this menu item only a character is printed. Maybe i'm not using it correctly.
If I add a textbox is it possible to change its size using mouse at runtime? And can i save it with rtb document?
Dec 22 '08 #4

QVeen72
Expert 100+
P: 1,445
Hi,

I Guess, it is not possible to change the size at runtime..
The Code works Perfect here..
It IS not an Actual TextBox,
A Single-Row-Single-Colmn-Table is being added to the exisiting RTB at the selected Cursor Position....
from the code, "cellx1636"
change 1636 to some other number top change the width..

Regards
Veena
Dec 22 '08 #5

P: 15
thnx veena but i want smthg whose size can be changed
Dec 31 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.