Forms :: Replace & With & In Dir To XML
Apr 25, 2009
Ok i have a function that lists a dir's contents and creates an XML file in a certain format, but if it comes across a file name that has & in it the xml is not 100% valid so i need to replace all instances of & with &
Private Sub DirXml_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DirXml.Tick
If ListBox1.Items.Count = 0 Then
[Code].....
View 1 Replies
ADVERTISEMENT
Mar 10, 2009
I am trying to filter out all unwanted characters from a string. All I want in the string is letters A-Z, numbers 0-9 as well as comma (,) plus (+) and quotes (").I figured how to do the letters and numbers, but the 3 special characters are giving me a problem. I also tried with the Chr(34) equivelant for the " sign, but no luck, as and " or , messes up the way the code is read. Here�s what I have so far, but it only works for A-Z and 0-9:
STR = System.Text.RegularExpressions.Regex.Replace(STR, "[^A-Z, 0-9, Chr(43) ]", "")
View 4 Replies
Nov 13, 2011
1) a text document which has content like :
uber|uber|ultra
taxi|taxi|taxi cab|cab|minicab|airport taxi|airport transfer
genitalia|genitalia|genitals
[code].....
View 1 Replies
May 5, 2009
The file reads in parameters and two of the parameters used to be in Date Format YYYYMMDD but will now permanently be in format YYYY-MM-DD. This change, I believe, is stopping the import of the file from working. I would like to replace the new format YYYY-MM-DD back to YYYYMMDD in the code. If possible I'd also like to see some output so I know that the old format has been replaced with the new format. The code is below. I added the two rows with .replace code in green in expecting that to be enough but it is still not working.
Public
Sub Main()
Dim R1, O1, P1, C1, strDateFrom, strDateTo, strRunDate
As
String
[CODE]...
View 3 Replies
Dec 8, 2008
I'm working on a timekeeping application in Visual Basic 2008 and am having trouble formatting a timespan for display. Here's how I want to the information:If a positive number my Label will be: lblTimespan.txt will show as "12 Hours And 15 Minutes" This works fine.If its a negative number I want to display it as "(12 Hours And 15 Minutes)'[ in red. The problem is that I can't get rid of the minus sign. [code] Thr Replace doesn't seem to want to replace the "-", can anyone suggest what to do?
View 2 Replies
Dec 9, 2011
I have a bunch of object variables which are all initialised in their declarations such that:
Private _myObject As New ThisObject("SomeString")
where ThisObject is one of a number of object types, but all are initialised using a string.
I would like to use the Visual Studio Find/Replace dialog box to search for "As New" then replace everything from "As New" to the first set of speech marks with some text such that:
EDIT
My original example could be solved using other methods. This example is more representative of the actual problem:
Private _myObjectA As New ThisObjectA("SomeString")
Private _myObjectLongName As New ThisObjectLongName("SomeString")
[Code]....
View 2 Replies
Jul 13, 2009
I am trying to think of a regex replace to replace double quotes with nothing. Example:
hello("hi there") would become hello(hi there)
"hi" would become hi
"example "3" would become example "3
-edit Maybe an easier way to explain this is, replace all " that do not have a backslash before them.
View 6 Replies
Mar 6, 2010
How can I specify in my string that I want to replace occurrences of ALL characters and replace them with a specified character? Something like this:
'assuming currentWord is a string that contains any word
_myWord = CurrentWord.Replace("a-z,A-Z", "*")
View 3 Replies
Jul 7, 2011
I am using replace function to replace a character in the file
sw.WriteLine(Regex.Replace(strLine, "\", Chr(13)))
This code is working fine, but now I want to replace two times and I want to use the replace function twice. Something like this, but it is not working . Can anyone tell me how to use Replace function multiple times?
sw.WriteLine(Regex.Replace(strLine, "\", Chr(13)).Replace(strLine, Chr(13), ""))
View 2 Replies
Apr 7, 2009
Suppose i have two strings which is given below.
CODE:
Where ever i find , it should be replaced one blank line and " replace by "
When i migrated the data from MYSQL to SQL Server 2005, i found few problem in one of the column. In MYSQL indicates as new line and " indicates as ".
View 7 Replies
Apr 8, 2011
I got this problem, is there way to use "replace" function to replace multiple strings of same list?
Like;
Dim rList As List(Of String)
rList.Add("A")
rList.Add("B")
[Code]....
View 3 Replies
Mar 8, 2009
I am trying to do this(will explain below) :
If RichTextBox1.Text = "" Then
MsgBox("No text selected!", , "Warning!")
Else
[CODE]...
I created a button , i have a richtextbox , i want to do this : i will right something in the richtextbox , and when i will select what i wrote and click on the button it will replace it with <font color="">something</font>. but instead it rights next of what i selected .. any clues how to replace it and not right next to it ?
View 7 Replies
Nov 3, 2010
I'm a "noob" to .Net and know very little. Nothing but basics really. I'v been searching the interwebz for a solution to this as well as these forums and I have found nothing .I want to automate this process requiring only a simple button.[code]...
View 1 Replies
Aug 3, 2011
I have strMyText where I want to replace all instances of "http", "www", ".com", "cat", "dog" (and a few more) with "". What is the best way to do that?
View 2 Replies
Nov 22, 2011
The user enters a numerical value in textbox1 and click search. This searches for this value using PackageIO (any other options you guys think would be faster would be great) and will return how many instances of that value have been found. There is a second textbox and button that will only be enabled if 1 instance is found. If more than one instance is found, an error message pops up. I'm not too experienced with PackageIO. Here is what I have so far. The program crashes every single time. I'm positive there is something wrong with either part of it or the whole thing.[code]...
View 5 Replies
Jul 11, 2011
I wrote my first program today and it works like I want it to Except when the Message box pops up there is a zero there untell you press the OK button then the answer displayes. How do I get rid of the zero or replace it with "Answer"?the program consist of 2 buttons, a labes, and a text box, when you enter a number in the text box then press button 1 the answer displayes in the label. If you press button 2 the answer displayes in a message box.I am new to programing and this is the first program i wrote without following a tutorial or book.[code]
View 14 Replies
Apr 23, 2009
I'm trying to do a 'find/replace' sort of thing, but for some reason the Replace function isn't working. It says it cannot be indexed because it has no default property. How do I do the replace correctly?ere's my
Dim aString As String
aString = Replace(DirectCast(Form1.SplitContainer1.ActiveControl, RichTextBox).Text, Me.TextBox1.Text, Me.TextBox2.Text)
View 2 Replies
Jun 24, 2010
AS In previous thread kaymaf and other helped me in how to extract the resources i have some questions i now need to replace the resource. use .net methods other than windows api Again let's take an example of file abc.exe i know the resource name and tpye how can i replace thr resource?
View 13 Replies
May 18, 2010
I currently have a sql command that inserts info into a table through one of my statements. One of the tables columns is defined as an integer. The integer value inside that columns cell's is one that I would like to retrieve, and then set it to a value my enumeration (a string value) and later display on my datagridview.
The problem I am having is that when I retrieve the column's value from the table(let's say 1) I can't set the value of the rows cell to my enumeration type, it tells me the table holds integer values only and so I can't change it to text. How can I accomplish retrieving my integer value, setting it to my enumeration type (a string value) and displaying it in my datagridview in the same cell that the integer was?
View 1 Replies
Nov 18, 2009
I have just download a fragment codes consist more 2000 lines. But it is designed by VB.NET 2005 so it contains index in first line [code]I want to write a program for split it. I think i have to loop through each line and check if it contains "." digit then i will create a array and split first element of that array.
View 1 Replies
Jul 6, 2009
I have a question on how to replace text. I'm new to programming and I'm making OCR program. It converts image to the text and puts it into a TextBox. How can I replace space to "." and "$" to ""(nothing) before it inserts text to a TextBox? [code]
View 11 Replies
Jul 9, 2009
my string is like this
tFunName= t11+t1* t2% t11
i want replace t1 to Text1
tFunName= tFunName.Replace(tControlName, PropertyValue)
But result is come like this -> Text11+ Text1* t2% Text11
But i dont want like this i want replace exact t1 Only and i want result like this t11 + Text1 + t2 + t11
View 1 Replies
May 6, 2011
I have code that look like this.
<DllImport("user32.dll")> Public Shared Function SetParent(ByVal instr As IntPtr, ByVal outstr As IntPtr) As IntPtr
End Function
[code].....
View 20 Replies
Sep 22, 2011
Im trying to change some location in a string but cannot understand why the following code is not working.The first line returns the correct value (replacing 2 digits after digit 9) but the second line is not. Its replacing the correct digits (position 13 with 2 digits) but also position 3 and 4 when it should not.
Sub TEST()
':::::::::: Change date ::::::::::
Dim _year, _month, _day As String
'_year = Me.dtSerial.Value.Year
[code]....
View 4 Replies
May 16, 2012
I am making a program i.e. a script converter. I tried the Replace Command TextBox1.Text.Replace("Hi", "Hello").Replace("Hello", "HI")But this doesn't work. It doesn't replace the second time correctly.
View 2 Replies
Jul 18, 2011
I have a csv file which have data like this:
Date,val1,val2,val3,val4,val5,val6,.......val47,val48
18/07/2011,0,0,0,10.98,0,0,0,10.98,10.98,0,0,0,0,0....,0,0
Now i need to compare the date value of existing row with new row's date value. If equal then need to replace the exisiting row with new row. If not append the existing row. I tried in follwing way. If dates are not equal, the new row is getting added but if dates are equal could not able to replace the existing row. Any suggestions please?????
Imports System.IO
Public Class Form1
[code]....
View 1 Replies
May 17, 2010
How can I change the value of one data grid view's cell? I am trying to change the displayed value of an integer (0-5) into one of my enumeration value.
i.e. the current cell displays 3 and I want to change the displayed 3 into the fourth value in my enumeration.
View 5 Replies
Mar 25, 2011
I m trying to read a text file, make some changes and write to another file.[code]...
View 1 Replies
Sep 21, 2010
Currently, I'm developing a project related to RFID which includes display data real time on screen. (I have a SQL Server 2005 express database. Once reader throw me a tag, I will go and pull the related information of this tag from DB and return to windows application.)One of the windows forms will display the tag data that has been read by the RFID Reader with related information. And I use DataTable to keep this data and on my form I have one GridView which datasource is point to this DataTable. (I have 10 readers which will throw me the tags that had been read and so data will come in simultaneously)
The problem is during reading and displaying information on grid, sometimes the datatable throw me an error of "DataTable internal index is corrupted: '5'".I found some post that said to use BeginInit, EndInit and Accept Changes.
I want to know is "Is there any solution that I can replace datatable with???"
View 3 Replies
Sep 29, 2009
So I'm importing Excel data using ADO into a DataTable then pushing out to an Access DB. A couple of the Excel columns have several blank cells that I would like to change to a zero before pushing it out. How can I check/change the DT null values to zero? I've done some searching but was wondering if I could do it without a loop.
View 3 Replies