Everyone has probably used or at least seen the find and replace feature in programs. This allows the user to find everything that matches the specified text string and replace it. This source sample demonstrates a very bare bones version of that same functionality in Visual Basic. In general to find a sub string in a parent string you can use the InStr function which is demonstrated below. However, in order to replace the found strings with a new one you need to get a little bit trickier. See below for how this can be done in a text box.
To try out this code create a new project, add a command button to the main form, add a text box as well. Double click the command button to into the click event handler for your button. In this method add the following code.
Once you have the code in place run your application and add some text that has the string test in it. Hit the button and you will see all of these instances of the word test replaced with the string 'MyString'.
Note: The source for this was found at DreamVB which is no longer online.
How to import text and xml file into new created file
I want to import text tab and comma delimited and xml data into other text file which will be created at run time. help me please in this way.
pls help me on linking the vb
pls help me on linking the vb and the crystal report
pls help me on linking the vb
pls help me on linking the vb and the crystal report
txtUser control
hello
now i got a problem with txtUser text box which has txtUser.MaxLength= 15
i want to use a MsgBox to dialog with the input, if entry exceed the
maximum length of txtUser.please help me
please the save settings
please the save settings command is not working, is there going to be any declarations please, and with another example using checkbox or option button
like in vb6
list list1,"vew","tablename",fieldname","fieldname like '"& text1.text &"%'"
You have to have a textbox
You have to have a textbox on your form named text1.
this code doesn't work
this code does not work for me. i get a run-time error 424: object required. the debug points to Line 6 & i'm not sure how to fix it.
but how in the If statement
but how in the If statement when you are you listview
Post new comment