473,398 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

VB6 RichTextBox string processing: Create like VB Code editor

487 Expert 256MB
Two things i have to do.
RTB->Rich Text Box
1. Listbox(Or list view) should follow the cursor position.
2. Important: Get the word of deleting char in RTB Text. (Not in the end of RTB text).
Ex: Clicking any word in RTB text and delete any char in that word, here i want the word before deleting any char.
any help will be a good clue for me. Thank You
Oct 21 '13 #1

✓ answered by CyberSoftHari

I got the solution for my listBoxControl move over the cursor Position.
Expand|Select|Wrap|Line Numbers
  1. Private Declare Function GetCaretPos Lib "user32" (lpPoint As POINTAPI) As Long
  2. Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
  3. Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
  4. Private Type POINTAPI
  5.     X As Long
  6.     Y As Long
  7. End Type
  8.  
  9. Private Sub RichTextBox1_KeyPress(KeyAscii As Integer)
  10.     Dim tCaret As POINTAPI
  11.     GetCaretPos tCaret 'get the Caret Position in RichTextbox Coords
  12.     ClientToScreen RichTextBox1.hwnd, tCaret 'get the Coords in Screen Coords
  13.     ScreenToClient hwnd, tCaret 'get the Coords in Form Coords
  14.     List1.Move ScaleX(tCaret.X + 3, vbPixels, vbTwips), ScaleY(tCaret.Y + (RichTextBox1.SelFontSize * 1.3), vbPixels, vbTwips)
  15. End Sub
  16.  
Now looking for my second solution, i.e, Get the word of deleting(Or backSpace) char in Rich Text Box control. Thank you.


I done my second problem like below
Expand|Select|Wrap|Line Numbers
  1.     RichTextBox1.UpTo " ", False, False
  2.     RichTextBox1.Span " ", True, True
  3.  

1 1845
CyberSoftHari
487 Expert 256MB
I got the solution for my listBoxControl move over the cursor Position.
Expand|Select|Wrap|Line Numbers
  1. Private Declare Function GetCaretPos Lib "user32" (lpPoint As POINTAPI) As Long
  2. Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
  3. Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
  4. Private Type POINTAPI
  5.     X As Long
  6.     Y As Long
  7. End Type
  8.  
  9. Private Sub RichTextBox1_KeyPress(KeyAscii As Integer)
  10.     Dim tCaret As POINTAPI
  11.     GetCaretPos tCaret 'get the Caret Position in RichTextbox Coords
  12.     ClientToScreen RichTextBox1.hwnd, tCaret 'get the Coords in Screen Coords
  13.     ScreenToClient hwnd, tCaret 'get the Coords in Form Coords
  14.     List1.Move ScaleX(tCaret.X + 3, vbPixels, vbTwips), ScaleY(tCaret.Y + (RichTextBox1.SelFontSize * 1.3), vbPixels, vbTwips)
  15. End Sub
  16.  
Now looking for my second solution, i.e, Get the word of deleting(Or backSpace) char in Rich Text Box control. Thank you.


I done my second problem like below
Expand|Select|Wrap|Line Numbers
  1.     RichTextBox1.UpTo " ", False, False
  2.     RichTextBox1.Span " ", True, True
  3.  
Oct 22 '13 #2

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

Similar topics

1
by: Matt | last post by:
Is there any way to display one routine only in the Code Editor, like it was possible to do in VB6? Or is there an Add-in free or on-sale that does this? Or is it possible to create ourselves...
6
by: Alexander Muylaert | last post by:
Hi Does anyone know a good starting point about high speed string processing in C#? What I need is a very fast routine for a case insensitive "contains". e == E == é == ë == ... Kind...
2
by: Groide | last post by:
Hello, I'm crazy but I want create an editor with c# and System.Windows.Forms.RichTextBox. I have many difficult to create the effect to highlights the text and to close the tags. This is my...
4
by: Vinay Agarwal | last post by:
Hello, I would like to maximize efficiency of string processing in my C# application that works with Skype API. Actually, these "strings" are made of "chars" that are all 8-bit values except 0...
29
by: zoro | last post by:
Hi, I am new to C#, coming from Delphi. In Delphi, I am using a 3rd party string handling library that includes some very useful string functions, in particular I'm interested in BEFORE (return...
1
by: Eric | last post by:
Using the 1.1 framework. We are using a newly created instance of a RichTextBox Class in our server code to manipulate RTF that is stored in the database. To clarify, we are not using or...
11
by: billpaterson2006 | last post by:
I've been working on some code to search for specific textstrings and act upon them insome way. I've got the conversion sorted however there is 1 problem remaining. I am trying to work out how...
13
by: Bryan | last post by:
I am developing a VB project in VS2005 that has SP2 installed. This is the process that is causing a problem: Open VS2005, open the project Write some code in the code editor Run the project in...
2
by: YASIN786 | last post by:
hi all i am helping a friend to develop a java program to implement the following features but i cannot understand how to go about this problem. A text file contains a number of English...
25
by: doznot | last post by:
Let's say you want to use Moodle to teach an introductory class in PHP programming. Some of the students have little or no computer experience. In addition to background reading and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.