o
k
q
u
e
s
t
i
o
n
s
.
c
o
m

Replace string data when using Input -

I have a text file that I want to load using:

Open CommonDialog1.FileName for Input as #1
Do until EOF(1)
Line Input #1, sLine
sFile = sFile & sLine & vbCrLf
Loop
Close #1

Text1.text = sFile


This works fine... as it should. However, the file being opened is from a Linux computer, and there are only carrage returns, not carrage returns & line feeds. I want to use Replace to replace the 'vbCr' with 'vbCrLf' as it is inputing, but...

Any ideas?

Thank you.

 

Remove strings 3 last letters -
Hi, I'm trying to remove the last three letters from a dimmed string and they are " & " I've googled it but cannot find how to remove just the LAST letters I tryed Right$ but it didn't work correct (unless I did it wrong). Anyways here's the source. Dim EX As String


Replace string data when using Input -
I have a text file that I want to load using: Open CommonDialog1.FileName for Input as #1 Do until EOF(1) Line Input #1, sLine sFile = sFile & sLine & vbCrLf Loop Close #1 Text1.text = sFile This works fine... as it should. However, the file being opened is fro


Need some help with find and replace function -
I have started to get into VBA in recent months, and just came across something that has become a bit confusing. It's basically a find and replace function with multiple parts. I have two worksheets in the workbook. 1) input sheet 2) data sheet In the input sheet I have a symbol wh


Replace text with full ASCII code -
does anyone have that code that will replace everything in data.txt with it's ASCII code? or a function that will do it? Something like this: Private Function ASCII(data As String) As String data = Replace(data, ">", "%3E") data = Replace(data, "


Replace "," in string -
VB6 I'm reading in data from a flat file with .... Input #1, dummy With List_rs .AddNew .Fields("jono") = Mid(dummy, 3, 6) etc .... However, "dummy" may containg a comma (,) which causes the the input to stop at the point


[2008] String replace in RTF file -
Can anyone tell me what's wrong with this code ?? Code: Dim input As IO.StreamReader = New IO.StreamReader(Application.StartupPath & "\dcm.rtf") Dim output As IO.StreamWriter = New IO.StreamWriter(Application.StartupPath & "\dcm\" &a


SQL Replace Function -
I am trying to use the REPLACE function to replace a string. The only problem is, I want it to replace any string besides a certain few. So I want it to replace anything that is not 'AB', 'AC', or empty string ''. The column can contain many different strings, hardcoding each var


Count in string.replace -
Is there a way to get the number of substitutions made using a string.replace? e.g. how many times ReplaceText is used in MyText.Replace(FindText, ReplaceText) Id prefer not to use a regex, since my text has control characters throughout (unless there's a way of duplicating the stri


String Replace Question -
I am currently using the replace function to manipulate my string to remove characters that are not numeric or alphabetic. At first the data contained only five characters that I needed to replace, now the data has changed to include all characters (@,#,<,>,*.....etc). Is the


modifying 2 characters in a string -
I have a string of 880 characters. I need to know how to replace the 740 and 741st characters with 2 different characters. I can't use the replace function since the 2 characters to be replaced may not be known. Code: Open sFileName For Input As #iFileNumWrite Do Line I


INET assistance, PLEASE!!!!!!!!!!!! -
I am having a horrible time right now with INET. I need some assistance if someone can help me. I am writing a program in VB6 using INET controls to take a file and post the file up to a web service using HTTP POST protocol. The server on the opposite side is returning a response to


needy da help -
how do i make a command button that saves a few lines of data (mainly label captions) into a txt file ??? will this work ? Dim l1 As String Dim l2 As String Dim l3 As String Dim l4 As String Dim l5 As String Dim l6 As String l1 = Label7.Caption & "$ " & lbl


Replace text in a string[resolved] -
Hello peeps! I've got an issue where I'm using replace function and cannot get it to work correctly. I've got a string like "hello1,hello2,hello3,hello4,etc...." If I use string = replace (string,chr$(44),"",12) My text before chr 12 will be removed. Is th


[02/03] Find and replace in a text file -
Hi I have a scritping text file build by DOS...its has 3 elements in it that I need to change...the bit of text will be diff each time but the structure and location wont change..so basically a find and replace thing How would I search for filename after file=D:\Data\OPC\ and r


Override Replace() -
hi i would like to ask how to override the function Replace() the Replace function has Function Replace(Expression As String, Find As String, Replace As String, [Start As Long = 1], [Count As Long = -1], [Compare As VbCompareMethod = vbBinaryCompare]) i would like to ask


String Replace -
Is there a function in the Java API to replace strings ? There are methods in the String and StringBuffer objects to replace a single character, but is there any such method for replacing an entire string? .


replace all -
How can I replace A With B in the string: I used this JavaScript code: var Y=X.replace('A','B'); but it is replace one letter only from the string ... I want to replace all A with B.


Replace text, only once -
Hi, Is there any way to replace a certain string inside of a string, but only once. Right now I'm using replace(WholeString, WhatToChange, ReplaceWithWhat) but it's changing every instance. Can I have it replace only the first instance in the string? Thanks!


Replace text string in memory -
Hello guys i want to replace text string in memory of my vb application.So it will replace string in itself. Or better way.It should find at what address is this text string is located and then replace it. Any help please? Programs will be like program for cheating games


[2005] IDE regex/pattern matching. Pattern in replace text -
When I have a regex of ^.*\(:q\).*$ and say that matches object.array("one") how can I replace it with object.array["one"] keeping in mind that the data outside of the quoted string isn't always the same? If I try it out, the replacement is actually a regex (the


Convert character to string. -
Please see code below. I think it will slow if it work with big loop. If who have the best method to convert character to string please tell me. Code: Private Sub Command1_Click() MsgBox Convert2String("bc") End Sub Private Function Convert2String(ByVal tmpSt


Coding Problem -
I had this code: Dim StrData as String Open "C:\myfile.log" For Input As #1 Do While Not EOF(1) Line Input #1, StrData If InStr(1, StrData,"PENDING") > 0 Then Replace StrData, "PENDING", "CLEARED",


Replace Within A String... -
Can someone help me replace something with something else in a string. I know all about the Replace function, but to use that you need to know the exact characters your replacing, right? Well say I have a string that says "010115500." If your asking why I store numbers in a s


String Manipulation. -
I've got a small bit of string handling I need help with. Say I have a string, containing any random amount of characters and somewhere in that string is this "VALUE(A)". Now, say in my code I have a value assigned to A which is 3. What I want to do is replace the bit &quo


How to map elements according to line no's -
Hi,Please help me i am struck at one pont... Suppose we had 1 1 2 3 4 31 4 2 3 1 21 3 2 1 4 14 2 3 4 1 and i sorted index,and i got the below 1 1 2 3 4 -- > line 1 14 2 3 4 1--->line 2 21 3 2 1 4---->line 3 31 4 2 3 1---&


How Do I Find and Replace.... -
Hi, I'm trying to write a piece of code that will look for text thats inputted in my FindString text box in my Source text file and replace it with text in another text box and write it to my target file. How do I go about doing this. I've got this far and now I'm stuck. I know how to


Help On Loading Data From File -
Ok I want to load data that was written to a file on to my program. and im using this code to do so......... Dim file As String 'Replace 'c:\autoexec.bat' with the file you want to load to the TextBox file = "c:\Windows\system32\Info.txt" Open file For Input As #1 Text


Need help with editing Binary files...HELP!!!! -
Basically i have made a small program that uses the Replace function to search for a specified string and replace it with whatever i choose from a binary file..i'm just having problems replacing non string characters...In the Replace(variable, "string", "different stri


Automating search & replace in Word using VB -
I'm trying to help out a friend do a massive search and replace in Word (thousands of documents) to replace a string that was incorrectly entered when the documents were created. So far I've gone for the bare bones approach, using a DIR /B to get a list of the files, then a FOR /F t


-vb6-how to replace string -
so i am looking for code which will replace some string...like bad words filter...example user will type in textbox: BOT and program will automaticly replace O with A or something...i wanna also add in code which strings i wanna replace... thanx for help!


Find and replace from external file -
I've developed a pgm to find for a string and replace it in a text file loaded onto the textbox. I've numerous strings to be replaced in that file. SO I' tried replacing the old strings using 2 methods 1) Using old and new strings stored separately in 2 text files (oldstrings.tx


replace in a string using vb5 -
Hi Could someone tell me how to replace the commas in a string with a backslash. ie 302,456,987,000 needs to be 302/456/987/000 I have vb5 which doesn't have the replace function. how would I do this Many thx Locutus


Replace string with a single character string of the same length -
Basically what I'm trying to do is replace a string with another string which is made up of a single character, but the same length as the original string. Let's say for instance I have the phrase 'fee fie foe fum' and I want to replace 'foe' with the letter 'a' so I would end up wi


Why doesn't this work -
I want to create a menu using the TreeView Control and Import the menu from a file. The file's content is like this: Node -SubNode1 --SUBSubNode1 --SUBSubNode2 -SubNode2 -Node2 -SubNode1 ETC... I'm using the following code to add it to the treeview, but it is not workin


replace data from text file -
I am trying to open a txt file, search a particular item from it and replace it with a new figure.I am able to search the field and display it but i am not able to replace it. In my form there is one 'display record to update' button which when pressed asks which record to change, then


replace(random character with dot) -
I have a fair idea of how the replace funtion works..as shown below I can replace b with c,but say for example I have random names in a txt file, shaun mark william james can i replace the second character of each name with a dot or another character,the names will vary in len


input/output with a twist (of lime) -
HI, I love this site. I have already made some code examples work well. I would like to read in a text file line by line (I guess) I want to replace a piece of data on a known line eg.6 with a similar piece of data. The tough part is that i do not fully know what the data to


Replace string in string -
Hi. I have a small question: how could I replace a substring in a string. For example I have this string "ABCDDDDEFG". I want to replace "DDD" with "54" for example. Is there any command which allows me to do this? Thank you!


Serial data string to multiple textboxes -
I have tried to read from the serial port and display the string content to 4 textboxes. Problem is when I use Mid, then only the first Textbox displays data, there is nothing on the others. If I jump over the first one then only the second one shows data. [Private Sub btnVoltage_


[2005] Filling empty database -
I have filled datatable with data (working fine) and now I wanna put this data from datatable to new and empty table (in different db) with exact the same fields. Code: Private Sub frmCopyBase_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load