473,503 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

text editor in vb 2005

20 New Member
Hi,
I wanted to know how to add a replace method to a text editor (notepad) to search for a word and replace it
1. say in (notepad) you type something in the textbox1-------"me"
2. then am suppose to type "me" in text box 2---and
3. click the find button and it suppose to find the text in textbox1
4. then you type in textbox3---- "us" and
5. click the replace button and it replaces "me" with "us"

how do i do this?
Apr 10 '09 #1
4 1790
thoffman
5 New Member
mygirl22... That would be Ctrl+H in both notepad and VB 2005 Express... It's also located under the "Edit" menu... "Find and replace"
Apr 11 '09 #2
aryanbs
42 New Member
Hi mygirl22 (oops sorry)
You do post in MSDN social forum too, right?

Ok to find the text..do following, suppose you are finding text from textbox2

Expand|Select|Wrap|Line Numbers
  1. TextBox1.HideSelection = False 'can be set once in design time
  2.  
  3.          TextBox1.SelectionStart = TextBox1.Text.IndexOf(TextBox2.Text, StringComparison.OrdinalIgnoreCase)
  4.         TextBox1.SelectionLength = TextBox2.Text.Length
Now to replace,
Since you have already highlighted the found text, just do

Expand|Select|Wrap|Line Numbers
  1.  If TextBox1.SelectedText.Length > 0 Then
  2.             TextBox1.SelectedText = TextBox3.Text
  3.         End If
Apr 11 '09 #3
mygirl22
20 New Member
thanks, i appreciate it..
Apr 12 '09 #4
mygirl22
20 New Member
ok i did the find method but i have a problem..it also needs to act as a "find next"...meaning that
1.when i click the find button,
2.in the main form, it should find the text
3. and when i click it again
4. it should find the same text again ..if it's in the main form

i can't figure out how to write the loop..plz help...
this is what i have so far
Expand|Select|Wrap|Line Numbers
  1.  Private Sub xFindButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xFindButton.Click
  2.  
  3.         Dim startPos As Integer
  4.         startPos = xTxtSourceTextBox.Text.IndexOf(Me.xFindTextBox.Text) ', type)
  5.         If startPos = 0 Then
  6.             Me.xTxtSourceTextBox.Focus()
  7.  
  8.              End If
  9.         If startPos < 0 Then
  10.             MessageBox.Show("The String '" + xFindTextBox.Text + _
  11.             "' could not be found", "Text Not Found", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
  12.             Return
  13.         End If
  14.         Me.xTxtSourceTextBox.Focus()
  15.         xTxtSourceTextBox.Select(startPos, xFindTextBox.Text.Length)
  16.         xTxtSourceTextBox.ScrollToCaret()
Apr 15 '09 #5

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

Similar topics

11
3466
by: Ed Suominen | last post by:
I'm thinking of implementing a real-time collaborative text editor in Python using Twisted. An initial plan is to use a Twisted PB server daemon that accepts user:password:file connections from...
1
3728
by: IkBenHet | last post by:
Hello, I found this script to create a simple rich text form (http://programmabilities.com/xml/index.php?id=17): <html> <head> <title>Rich Text Editor</title> </head> <body>
10
2147
by: st4 | last post by:
Help, As part of my family history web site i need to get 150 pages of typed text into some format to display. It just text right now but I would like to add some graphics (photos) and make the...
9
2778
by: Frances | last post by:
at work we switched to UTF-16 encoding and now when I open html files in HomeSite the code is all messed up, and if I turn on "enable non-ANSI file encoding" code looks fine when I open files but I...
8
1970
by: Steve Mills | last post by:
I opened an mdb file with a text editor, deleted random chunks of data from it and then saved it. Now it won't open. Fortunately, it wasn't one of mine - it was from the accounts department, but...
7
1461
by: Michael Peters | last post by:
I need a simple editor to edit the texts in static html pages. Is there a program for that? It should be something very simple, nothing like Dreamweaver. I don't need to edit any tables,...
18
30812
by: siliconwafer | last post by:
I want to create a text editor using C. I want user to enter text freely without worring about what's gonig inside. I tried some combinations of fgets,fgetc with realloc and stdin as poniter.Bute...
3
1263
by: Lee | last post by:
I've just started using VS(2005) and the first couple of projects I've used VB since it's easy and I wanted to get my feet wet with the framework. Now I want to start on some C#, but I can't...
1
1579
by: Victor | last post by:
Hi guys I have a small question abou the vs2005's text editor. in my text editor, any space or tabs become little dot. i forget what shortcut i pressed.It looks not right to me at all. Can anyone...
3
14546
by: danesh1354 | last post by:
Hi All, First I need to construct a text editor by python programming and add this code to a biger code that has been written before, and i would like that by my code for this editor have a...
0
7205
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
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
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,...
1
7008
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
5594
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,...
1
5022
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...
0
3177
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...
0
1521
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 ...
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.