It is successfully removing 2, f and s..but it won't remove all the blank spaces. I am wanting my string to remove all the spaces...example "22f 33s 99y" would become 22.3399 instead of 22.33 99
I code in VB using VS2010..I have a richtextbox with variously coloured text.I use richtextbox.find to locate and highlight a word.I use richtextbox. replace to replace it with another word..The word is replaced - but all the colours disappear!
I want to replace a regular link with a hyperlink in my RichTextBox, all of the information is given to me via a outside library (LinkEntity). But I don't know how to actually go about replacing the text.
I have this, but it does not work right, sometimes it throws a value cannot be null exception, and sometimes it just replaces the wrong part of the link.
im currently messing up with 20 richtextboxes, and i have this issue right now.... Everytime a user leaves the richtextbox, the richtextbox should automatically scroll back to the beggining, i do that by using this
I am trying to use this code to shorten words like Hello to Hi, and Whats up to sup in a rich text box. If Value.Contains("Hello") Then Value.Replace("Hello", "Hi") End If End Sub
I want to replace the current word under mouse cursor while user click on contextmenustrip dorpdownitem. I can get the word but unable to replace the word with new one.
Here is my code: Private Sub tsmmutradifat__DropDownItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles tsmmutradifat_.DropDownItemClicked Dim myclickeditem As String = correct_word(e.ClickedItem.Text) Dim wordtoreplace As String If Not myclickeditem = Nothing Then If RichTextBox1.SelectedText = "" Then [Code] .....
I have a richtextbox and a find and replace dialog and I would like to change the location of the dialog relative to the word that is found so it doesn't hide the word. I have searched and searched and cannot find a way to find out the coordinates of the found word.
I am trimming some lines in a RTB so I am putting the line into a string, changing it and then I want to replace the old one.[code]And when done simply replacing the original text with the fixed one.But id still like to know how to do it without this method.
I have a richtextbox in a form that opens a text file line by line.
Each line contains texts that is to be imported elsewhere and is delimited by commas.
The first two fields are dates and are fine. The remaining fields are all text and need quotations inserting.
For each line of the richtextbox is count the commas as it works through the string. For the first two nothing needs to happen. for the third comma a quotation mark is needed to the left (",); for count of commas 4 to 7 a mark is needed either side[code]...
How can I replace character/word in text (loaded to richboxtext) but only for those which are not on the "block" list ? Dim str As String = RichTextBox2.Text RichTextBox3.Text = str.Replace("1"c, "A"c)
But I want add list of words which should be excluded. I thought that I can do something like : Dim str As String = RichTextBox2.Text If Regex.IsMatch(RichTextBox2.Text, "shows") Then Else RichTextBox3.Text = str.Replace("%"c, " "c) End If RichTextBox3.Text = str.Replace("1"c, "A"c) Dim str2 As String = RichTextBox3.Text RichTextBox3.Text = str2.Replace("2"c, "B"c)
But it's not working as it will just skip replace of % for whole text and I want just just exclude particular word from list from being replaced...
I have big problem with my CHAT app. I want to add smiles but i have some problems. I using transparent Richtextbox, and when i try to use Regex system to replace text with image it work, but everytime other smiles disappearing, i only see last one. Second thing, i want to use GIF animated smiley and this Regex method don't work with all of these my problems. So i need an other way... Can anybody show how to do this
Imports System.Runtime.InteropServices Public Class TransparentRichTextBox Inherits RichTextBox
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
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?
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")
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:
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?
I'm making a program that uses a rich textbox and when you format the color of the richtextbox I want it to replace all instances of a color except black to have text on both sides of it.Example:If the text color is blue the text would look like this:
[color=blue]Blue Text[/color]
Where it says blue text that's where the text is blue. and if the text was red then instead of it saying color=blue, it would say color=red.
I have a replace function in text files where it replaces all the vbTab with ';' betweens the columns. Sometimes it may be that some fields have more vbTabs and then there is lot of empty fields.How do I via a smart and simple way to replace all vbTab with ';'. That is, the field has more than one vbTab will they just be replaced by a
vb.net Dim Fs As FileStream = New FileStream(my_filename, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)
Lets say I have a label with the text "_ _ _ _ _ ", some underscores. Now what if I want the program to locate the 3rd underscore and replace with something else. Is this possible? I was guessing by getting the character's position first and somehow there is a function that replaces characters by their position.