473,796 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Replacing a character at a position in RichTextBox

Al
Hi,
Is there any way to replace a character at a position? Without cussing the
RichTextBox to scroll. For example the following code will replaces the by
removing but the side effect is that it will cause it to scroll.
aRichtext.Text = aRichtext.Text. Remove(position , 1)
aRichtext.Text = aRichtext.Text. Insert(position , "Y")
Nov 21 '05 #1
2 3680
Hi Al,

If I have undestood the solution will be similar to:

aRichtext.Text = aRichtext.Text. Remove(position , 1)
aRichtext.Text = aRichtext.Text. Insert(position , "Y")
aRichtext.Focus ()
aRichtext.Selec tionStart = position
aRichtext.Scrol lToCaret()

I hope that helps.

Kind Regards,

Jorge Serrano Pérez
MVP VB.NET
"Al" wrote:
Hi,
Is there any way to replace a character at a position? Without cussing the
RichTextBox to scroll. For example the following code will replaces the by
removing but the side effect is that it will cause it to scroll.
aRichtext.Text = aRichtext.Text. Remove(position , 1)
aRichtext.Text = aRichtext.Text. Insert(position , "Y")

Nov 21 '05 #2
Al
Thanks Jorge, but it behaves the same as the origional couple lines :(

"Jorge Serrano [MVP VB]" wrote:
Hi Al,

If I have undestood the solution will be similar to:

aRichtext.Text = aRichtext.Text. Remove(position , 1)
aRichtext.Text = aRichtext.Text. Insert(position , "Y")
aRichtext.Focus ()
aRichtext.Selec tionStart = position
aRichtext.Scrol lToCaret()

I hope that helps.

Kind Regards,

Jorge Serrano Pérez
MVP VB.NET
"Al" wrote:
Hi,
Is there any way to replace a character at a position? Without cussing the
RichTextBox to scroll. For example the following code will replaces the by
removing but the side effect is that it will cause it to scroll.
aRichtext.Text = aRichtext.Text. Remove(position , 1)
aRichtext.Text = aRichtext.Text. Insert(position , "Y")

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3971
by: Chris | last post by:
Using VB6. With a RichTextbox, I can get the position of the character under the mouse pointer with an API call like: SendMessage(hWnd, EM_CHARFROMPOS, 0&, Pointl) by passing the mouse x,y co-ordinates in the Pointl structure. But does anyone know a way to get the *attributes* of the character (Bold, Underline, etc) WITHOUT affecting the textbox in any way? Any method that requires the character to be the selected text (like
2
8914
by: Hendrik | last post by:
Hi I have searched extensively for help on inserting text at the position of the mouse pointer in a text box as the final step of drag and drop process What I have come with is listed below - the problem is that the SendMessage function doesn't seem to perform the expected operation of moving the caret to position in the textbox where the mouse is pointing to. (can be text or richtext box either is good - sample code is based of attemp...
0
1521
by: Sakharam Phapale | last post by:
Hi All, How to get the starting and end character position of the given line no in RichTextBox? I have written following code but it takes more time. Is there any RichTextBox function or API function which gives that? Private Sub SetLineStartEndPosition(ByVal myRichTextBox as RichTextBox, ByVal LineNo As Integer, ByRef StartPosition As Integer, ByRef EndPosition As Integer)
0
4164
by: John Smith | last post by:
I have text files and I get binary offsets of text portion of these files from VB6 program with RichTextBox. I use VB.Net 2003 and need to select and highlight the text between given offsets. RichTextBox does not highlight the correct string as it treats new line pair as one character. Is there a way to highlight the correct string ? How do I translate real binary offsets to richtextbox offsets ? To reproduce: I have placed a text box...
32
3902
by: FireHead | last post by:
Hello C World & Fanatics I am trying replace fgets and provide a equavivalant function of BufferedInputReader::readLine. I am calling this readLine function as get_Stream. In the line 4 where default_buffer_length is changed from 4 --24 code works fine. But on the same line if I change the value of default_buffer_length from 4 --10 and I get a memory error. And if the change the value of the same variable from 4 --1024 bytes;
7
3516
by: aine_canby | last post by:
Hi, Im totally new to Python so please bare with me. Data is entered into my program using the folling code - str = raw_input(command) words = str.split() for word in words:
8
12368
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
I have a RichTextBox (rtfTerminal below) in which I would like to replace the last line with the last line minus its last character (i.e., do a backspace). I tried the following code, wherein I first get a substring representing the last line minus the last character, then rewrite it back over the last line. The substring itself looks fine but assigning it to rtfTerminal.Lines does not change rtfTerminal.Lines. As a matter of fact, I can...
2
9781
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, I have a somewhat long calculation report printed out in a RichTextBox. To find or monitor a particular value, users scroll down to the location of the data in the RichTextBox. However, when the user changes the input data, a recalculation is made and a new report is generated. This resets the RichTextBox vertical scroll bar to the top. I would like to be able to read the position the scroll bar is moved to before recalculation....
5
6100
by: Andrus | last post by:
I use Winforms RichTextBox control to edit scripts. Scripts are plain ascii texts. When error occurs, script engine returns character position of error in code as integer. How to position cursor to this character position ? RichTextBox does not have current position property. Andrus.
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10461
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10239
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4122
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.