Forms :: How To Add Text To RTB Without Replacing Existing Contents
Sep 14, 2011
Not sure what I am doing wrong here but I have 2 buttons and a rich text box. The issue is when I click the second button to add text to the rich text box and it over writes the current text that is already in the rich text box. How can I code this second button so that the text is added to the rich text box and not replacing the current text?
Here's my
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.Text = "This is the first line"
[Code] .....
Also how can I add spaces in a line of text (or in the middle of a sentence) so that I can insert a variable in the line.
Example:
"This is the" variable1 "line of text"
"This is the" variable2 "line of text"
View 4 Replies
ADVERTISEMENT
Feb 21, 2012
I am trying to restore SQL server DB, replacing the existing one but donot know how to do it.My purpose is to restore the backup file selected by user, no matter if file with this name is already attached to the server or not. If it is there, it should be replaced by the new one.
View 1 Replies
Mar 13, 2012
I have my battle systems code set to (attempt) to replace the test enemies data with the data that I have saved into a text file every time you either kill the enemy, or you leave the battle and come back to it... or if youve run away from the enemy.ive got two functions in the battle page, one of which is an agressive attack, the other of which is the running away function, and both of them are supposed to run the function that resets and reloads the enemies data from a text file, yet none of them are doing what they are supposed to do...
the problem that I am having is that when I either run away, or I kill the enemy, its data is never reset to the baseline of 2000, it is always, in the case of running away, what it was when I ran away, or if I killed it, it is a random value less than 2000...
here is the respective code
agressive attack:
Private Sub CMDagressive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CMDagressive.Click
'Dim previousdamage As Integer
'Dim originaldamage As String
[code]....
View 6 Replies
Mar 22, 2011
im trying to update the contents of a listbox by replacing the currently highlighted entry with a new value so far i have found the following to start off column1 is my listbox
[Code]...
but it keeps saying "Value cannot be null. Parameter name: value" for the first dim. how can i fix this? or this there another way to call the selected item without this complicated
View 4 Replies
Mar 20, 2009
I need to create a timer that sets the time from an existing text file. The time format in the text file is 00:00:00 (hours,minutes, seconds). An excerpt from one of my text files looks like ClockSet = "00:49:05"
Also, if possible, when the timer reaches 2 minutes I would like the backcolor to flash between red and green.
View 1 Replies
Jun 5, 2011
I am using vb.net to parse my own basic scripting language, sample below. I am a bit stuck trying to deal with the 2 separate types of nested brackets.
Assuming name = Sam
Assuming timeFormat = hh:mm:ss
Assuming time() is a function that takes a format string but
has a default value and returns a string.
[code]....
I could in theory change the syntax of the script completely but I would rather not. It is designed like this to enable strings without quotes because it will be included in an XML file and quotes in that context were getting messy and very prone to errors and readability issues. If this fails I could redesign using something other than quotes to mark out strings but I would rather use this method.
Preferably, unless there is some other way I am not aware of, I would like to do this using regex. I am aware that the standard regex is not really capable of this but I believe this is possible using MatchEvaluators in vb.net and some form of recursion based replacing. However I have not been able to get my head around it for the last day or so, possibly because it is hugely difficult, possibly because I am ill, or possibly because I am plain thick. I do have the following regex for parts of it.
Detecting the parentheses: (w*?)((.*?))(?=[^(+)]*((|$))
Detecting the square brackets: [[(.*?)]](?=[^[+]]*([[|$))
View 2 Replies
May 18, 2011
txt1 = help and txt2 = me! txt3 = not here, when i enter the other box i want the okay to drop sign to come up, after drop txt1=me! and txt2 = help.if i drag to txt3 display the can't drop sign.Iv'e tried everything all i can do is replace one way.also,i want the can't drop and can drop simbols to show.so far
Public
Class Form1
Private
Sub tbMouseDown(ByVal
[code]....
View 3 Replies
Jul 28, 2009
just wondering if it is possible to add a method to all forms in my project without having to do it on one form and Inherit all my other forms from that one
View 3 Replies
Mar 14, 2011
I'm building a program in which it asks for your name and age and determines a ticket price based upon these details. I want it to show the person's name, then their age, (jump down a line) then their ticket price, and then it jumps down a line to show the next person's name, age and ticket price. Issue is, when it's meant to jump down to show the next person, it just completely deletes the last person's details.I'm using this line of code:
TxtFareShow.Text = (Name & Age & vbCrLf & Price) & vbCrLf
How do I fix this?
View 1 Replies
Aug 9, 2009
i have a form (form1 for example) and there is a button ( button1) and too many controls in this form and i have form(form2) and too many controls in this form
i want when i click the button1 i need every control in form1 to disappear and instead i want form2 and it is contents to be loaded in the form1
OR
the second form is showing without the user noticing that there's too forms
(replacing)
can i do this and if i can't , can i create a custom control/controls to do this
and if i can how can i do this?
View 6 Replies
Apr 20, 2009
We want to Replace some text from a textbox (multiline) with = the text in our combobox and we want to replace it with its new one (in a textbox)
heres our code
If TextBox7.Text.Contains(ComboBox1.Text) Then
TextBox7.Text.Replace(ComboBox1.Text, TextBox1.Text)
End If
so that says, If the textbox(multiline) contains whats in our combobox, then replace it with the text in textbox1..
View 3 Replies
May 1, 2012
I am in desperate need of code that will allow me to search through a text file (.txt) and change the word "POLAR" to a string with a particular value, for examples sake lets say the string = "SUN"
View 1 Replies
Jan 31, 2011
Replacing text in an array ?
View 1 Replies
Jan 2, 2010
I have 2 questions regarding replacing certain text in a string which has been found using regular expressions.For example this is my string:"<span style="font-weight: bold">This</span> is <span style="font-weight: bold">2010</span>"
View 4 Replies
Mar 31, 2010
I need to make it so it will replace RichTextBox1's selected text with: <ST>, where ST is the initially selected text.
View 3 Replies
Dec 1, 2011
I have two lines of text which have long space (more like 14-15 spaces) before the actual text. I have tried simple replace to split and merge but nothing is working. I have also tried trim and the worst thing is that ASCII gives code of 32. But nothing works. Here is the text :
your heartburn symptoms Certain foods, such as fat, chocolate, caffeine and alcohol can aggravate heartburn symptoms 1 Certain foods (BTW it's not like it looks it is. In my actual richtextbox, when I select the space it gets selected as one big piece of space like a tab and i have also tried replacing vbtab but no use)
[Code]...
View 1 Replies
Aug 12, 2011
What I basically have is a small game which I want to count wins/loss/ties. I have no problem with the game aspect but need to know how I can replace a string in a csv file. IE: If Jim wins the game, his 5 needs to be turned to a 6. After googling quite a while I came across the replace() function, but it doesn't actually rewrite it back to the text file
Contents of users.txt:
Jim,1.jpg,5,1,0
Will,2.jpg,6,7,0
Tom,3.jpg,5,5,0
Snippet of
[code]....
The issue I have, is if I try to use any sort of IO function after this (WriteAllLines, streamwriter, etc) - I get a process is being used and can't touch the file (because its being read).Must I somehow create a new file with a copy of everything including the replaced string?
View 2 Replies
Apr 14, 2010
I am using the following code, but cannot get this to work. I have got it to work if the replacement is just of one word. So if the word test is replaced by mouse and the only thing in the file is the word test, it works.
How can I replace like this:
CH_IPVOD_filename.mpg > replace the CH_IPVOD_ with nothing for the result of:
filename.mpg
?
I would like to replace every instance of ch_ipvod_ with nothing.
Public Class Form4
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fso, inputFile, outputFile
Dim str As String
[Code] .....
View 6 Replies
Sep 14, 2011
Not sure what I am doing wrong here but I have 2 buttons and a rich text box. The issue is when I click the second button to add text to the rich text box and it over writes the current text that is already in the rich text box. How can I code this second button so that the text is added to the rich text box and not replacing the current text?Here's my
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[code]....
View 1 Replies
Jun 23, 2010
Having trouble getting this to work. I'm trying to replace the name of an old company inside a text file "Matrix Construction" with it's new name "Walsh Brothers" but it's not going to hot.
Imports System
Public Class ReplaceTest
Public Shared Sub Main()
[code].....
View 2 Replies
Feb 12, 2009
One of the features of the application I am working for is that it needs to check if an external windows application..lets call it A, is running. If it isn't running, then start it. If it is, then leave it.My idea originally was to use the process name as a filter. But the problem is that the process for application A is javaw.exe. Application A, belongs to a toolset, which has other windows applications, which have the same process name, javaw.exe.I already know that one of windows which has a javaw.exe process has "Edit"..in its title bar. So my algorithm to filter for app A is:
1. GetAllExistingOpenWindows
2. For each window in AllExistingOpenWindows
3. if window.processname=="javaw.exe" then
[code].....
View 1 Replies
Jul 31, 2009
I am editing an application that was developed using VB .NET. The form has a button, I see it in the code but it is not visible in the Form. Also, when I place a new button, it comes as Button2 meaning there is a Button1 - I am not sure how to find where it is and place it at the right place.
View 2 Replies
Jan 8, 2011
I'm new to VB and am trying to create something that will change specific words within a DB entry to a random word from a table. My goal is to change swear words to a random word in a separate table (like darn, dang, waterstopper, etc.) So far I have an "Input" table with the text I need to change and a "SwearRep" table with a list of words I need to replace in col "WBad" and their replacements in "WGood".
View 1 Replies
Jun 20, 2010
I'm a beginner who's been trying to learn Visual Basic for a couple of months now (no prior programming experience) and I was wondering if anyone would be so kind as to help a newbie like me out with something.
What I'm trying to do is make a Mad Libs-style program with a multi-line textbox and a button where I type in something like:
[Code]...
View 2 Replies
Jan 16, 2012
Replacing text with AutoText entries in Word 2007 using VB.NET
View 1 Replies
Mar 11, 2010
I am trying to replace a string which is actually different from line to line in a text file. I want to end up with a filename but without the path. For example:
My text file contains:
C: est estingmorefilename.mpg
C: est estfiles1 estfile4.mpg
W: estinglocation estingmore estfiles9.mpg
[Code]....
View 8 Replies
Mar 9, 2010
I am trying to do this but it doesn't work:
VB
Dim str As String = "07" & GetBetween("Stephen 0761234567", "07", vbNewLine)Dim op As String = "lol" TextBox1.Text.Replace(str, op)
GetBetween is just a function to match something between something else. That works fine, the string (str) sets as 0761234567 just like I want but when i try to replace the text it doesn't work.
View 2 Replies
Jul 9, 2009
Sorry if this seems like I haven't searched, however I have. Maybe I'm not understanding something or maybe I just haven't found what I need. Anyway my question is this. How would I find multiple strings in a text file and replace them? So far I've been able to find out how to replace a single string with:
[Code]...
View 3 Replies
Nov 10, 2011
I'll explain the scenario. I have a list containing character list and it's corresponding unicode characters(copied from CharMap and pasted in VB editor).
For example:
Text = Unicode --> Unicode character
---------------------------------------
K = U+004A --> J
[code].....
View 2 Replies
Jul 21, 2010
I'm trying to add a DataGridView to a Split Container Panel. I am able to add the control, but it just places it on top of the old one. What I want is to add it below the existing one. How to do it.
View 1 Replies