473,836 Members | 1,449 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Find and replace text di vb6

9 New Member
Hi All,

I have some problem with vb6 code.
I have a data contain :

:25:0186350587
:25:186350587
:25:86350587
:25:6350587
:25:350587
:25:50587
:25:587
:25:87
:25:7

I want it to insert zero number after :25: , but the number after :25: is always has to be 10 digit. So it would be :

:25:0186350587
:25:0186350587
:25:0086350587
:25:0006350587
:25:0000350587
:25:0000050587
:25:0000000587
:25:0000000087
:25:0000000007

I have a code in vb6 but it only insert two digit of zero number, so it would be :

:25:00018635058 7 (more than 10 digit)
:25:00186350587 (more than 10 digit)
:25:0086350587 (10 digit)
:25:006350587 (less than 10 digit)
:25:00350587 (less than 10 digit)
:25:0050587 (less than 10 digit)
:25:00587 (less than 10 digit)
:25:0087 (less than 10 digit)
:25:007 (less than 10 digit)

this is my code with textbox and command :

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdProses_Click()
  2. Dim txt
  3. txt = TextBox.Text
  4. If InStr(1, TextBox.Text, ":25:") > 0 Then
  5. TextBox.Text = Replace(txt, ":25:", ":25:00")
  6. End If
  7. End Sub
  8.  
Would you like to help me with the new code please

Thank you
Andi.

FYI
The link below is the complete of my program and the data that I want to change
http://docs.google.com/leaf?id=0B8HOco YLae3IMTU5YjMxN jUtNjg3MS00MjQw LTkwZmUtNjI2M2Z iMDNkMmM2&sort= name&layout=lis t&num=50
Jul 15 '10
18 3113
Andi Rustandi
9 New Member
I am sorry but I can't attach anything because all blocked by office proxy.

Regards
Andi
Jul 20 '10 #11
Guido Geurs
767 Recognized Expert Contributor
Can You download from this address (from your first call)?

http://docs.google.com/leaf?id=0B8HO...ut=list&num=50

Because I get an error ! = "Sorry, the page (or document) you have requested is not available"

Is it shared on Google ? = " Anyone with the link
Anyone who has the link can access. No sign-in required. "

Because I have a file shared on Google and the address is different !

http://docs.google.com/leaf?id=0BzRq...thkey=CL_zhPkJ
Jul 20 '10 #12
Andi Rustandi
9 New Member
Maybe this link will work

http://docs.google.com/uc?id=0B8HOco...download&hl=in
Jul 20 '10 #13
Guido Geurs
767 Recognized Expert Contributor
@Andi Rustandi
This one is OK.
The data is in UNIX format (only Linefeed)!
Can I change it to DOS format (CrLF) ?
Jul 20 '10 #14
Guido Geurs
767 Recognized Expert Contributor
I think this will do the job=

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdProses_Click()
  2. Dim ARRAYTEXT() As String
  3. Dim ARRAYTEXTidx As Integer
  4.    ARRAYTEXT = Split(TextBox.Text, vbCrLf)
  5.    TextBox.Text = ""
  6.    For ARRAYTEXTidx = LBound(ARRAYTEXT) To UBound(ARRAYTEXT) - 1
  7.       If (Left(ARRAYTEXT(ARRAYTEXTidx), 4) = ":25:" Or _
  8.             Left(ARRAYTEXT(ARRAYTEXTidx), 4) = ":28:") And _
  9.             Len(Mid(ARRAYTEXT(ARRAYTEXTidx), 5)) < 10 Then
  10.          TextBox.Text = TextBox.Text & Left(ARRAYTEXT(ARRAYTEXTidx), 4) & _
  11.             Format(Mid(ARRAYTEXT(ARRAYTEXTidx), 5), "0000000000") & vbCrLf
  12.       Else
  13.          TextBox.Text = TextBox.Text & ARRAYTEXT(ARRAYTEXTidx) & vbCrLf
  14.       End If
  15.    Next
  16. End Sub
PS:
I had also so questions with Your code:
- Why "New" in the menu when You will open a new file or Exit?
- Why "Close" button when You have "Exit" in the menu ?

I have taken the liberty to do some modifications (see attachment).
So if You want to use them, be my guest.
Attached Files
File Type: zip Find and replace text di vb6_with format_v6.zip (13.8 KB, 82 views)
Jul 20 '10 #15
Andi Rustandi
9 New Member
Expand|Select|Wrap|Line Numbers
  1. PS:
  2. I had also so questions with Your code:
  3. - Why "New" in the menu when You will open a new file or Exit?
  4. - Why "Close" button when You have "Exit" in the menu ?
Some time user want to have button to click but another user feel more comfortable with drop down menu.
But anyway thanks for the modification, it bring me new idea for the program.

Best Regards
Andi
Jul 21 '10 #16
Guido Geurs
767 Recognized Expert Contributor
I have done some cleanup and modifications (see attachment)

PS: if the text must put back to UNIX format: add a command with:
Expand|Select|Wrap|Line Numbers
  1. textbox.text=replace(textbox.text,vbcrlf,vblf)
Attached Files
File Type: zip Find and replace text di vb6_v7.zip (17.7 KB, 80 views)
Jul 21 '10 #17
Andi Rustandi
9 New Member
@ggeu
Thanks ggeu,

It really works, you are doing great job.

Thanks Again,
Andi
Jul 21 '10 #18
Andi Rustandi
9 New Member
Best Answer I've ever have

Great Job
http://docs.google.com/leaf?id=0B8HO...YzhmODMy&hl=in

Andi
Jul 22 '10 #19

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

Similar topics

2
13310
by: Svennglenn | last post by:
I'm having problems replacing text in a unicode string. Here's the code: # -*- coding: cp1252 -*- titel = unicode("ä", "iso-8859-1") print titel print type(titel)
4
2072
by: JackRazz | last post by:
I'm trying to use Visual Studio's Find/Replace to match VB declarations. This RegEx works fine in Regulator: ^\s*(Public|Friend|Protected|Private)*\s*(Shared|Overrides)*\s*(Sub|Function|Property )+ But when I try it in Visual Studio's find (with regular expressions turned on) it doesn't work. Are there any known problems with VS find or is there something wrong with the above expression? I'm new to them, so the second question...
2
1646
by: :\\\\derian | last post by:
anyone know where i could find the equivalent of the find / replace windows control for my project? :\\derian
2
10017
by: scorpion53061 | last post by:
This excel find/replace code works great under Excel 2003 but bombs with an error (pasted below the code) in Excel 2000. Can anyone suggest an alternative to make both happy? I am using vb.net windows application. I also tried creating an object and assigning the find/replace event to it but I also received errors. I am a little under the gun on this one.... WSheet.Application.Selection.Replace(What:="NONE", Replacement:="",...
1
19636
by: Mark | last post by:
Hello, Can anyone help me on how to find and replace text within a .txt file using vb.net? Any help would be greatly appreciated! Thanks in advance.
0
1122
by: D Brown | last post by:
Does anyone know why my .NET development would hang / freeze when performing a Global Find / Replace on all files? I have a large ASP.NET VB Application. I have left the machine for 24 hours but to no avail. I have to reboot the machine, delete the WebCache'd version of the application else I get the error message "Unable to get the project from the web server". I can perform a Find / Replace on each file in turn with no issues which...
5
4791
by: Casey | last post by:
Hello, Can someone give me specific code to replace text on a page using server side javascript? I need to use server-side because I need the output to be recognized in the final HTML so that google can index it. Here is a specific example of what I want to do: <div id=SomeText> Here is some text. I went to the baseball game </div>
2
1884
by: cewyattjr | last post by:
In a mediumtext field I have many instances of a URL, eg: 'http://myurl.com/index.php' that I want to replace with just '/' How can I write an update query that will update all instances of the URL in all records with this field? eg: select id, fulltext from content LIKE '%http://myurl.com/index.php%'
8
2733
by: John Pye | last post by:
Hi all I have a file with a bunch of perl regular expressions like so: /(^|)\*(.*?)\*(|$)/$1'''$2'''$3/ # bold /(^|)\_\_(.*?)\_\_(|$)/$1''<b>$2<\/ b>''$3/ # italic bold /(^|)\_(.*?)\_(|$)/$1''$2''$3/ # italic
1
2881
by: Lengara | last post by:
I have an Access form that will be FTPing information. The FTP info will be using a text file located on the hard drive. This text file will have symbolics in it that will be replaced by entries on the Access form. I am looking for code to open a text file in the background and run a find/replace based on fields on the form. Thanks.
0
9813
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
10831
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...
1
10582
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10247
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9367
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...
1
7778
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6976
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();...
1
4446
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
4005
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.