I'm coding in VB6. I have pictures in Picture1 and Picture2. I would like to replace the picture in Picture1 with the picture in Picture2. What code will get this done? Thanks.

Member Avatar
Member Avatar
+0 forum 3

Hello Daniweb Community, I was wondering if there is a way to replace words from a listbox. So at the moment I've got a listbox with a couple of strings to be replaced in the textbox, however single line listbox items work but when I add a multi-lined item eg. Hello There It'll go into the listbox as HelloThere, so when I go to use the for each to replace them It doesn't work. I've tried manually replacing it by using `TextBox1.Text = TextBox1.Text.Replace("Hello" & Environment.NewLine & "There")` it'll work, and if I try For Each lbItem In .ListBox1.Items TextBox1.Text …

Member Avatar
Member Avatar
+0 forum 3

Hi All, I'm trying to remove the <head> tag and contents from some html but I'm having no luck. The <head> portion of the html is: <head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style><![endif]--><title>Resume (Origin design)</title><style><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:"Gill Sans MT"; panose-1:2 11 5 2 2 1 4 2 2 3;} @font-face {font-family:"Bookman Old Style"; panose-1:2 5 6 4 5 5 …

Member Avatar
Member Avatar
+0 forum 5

Hello there, I got forum (phpbb3) and i have topics with a lot of links, like this: <a href="link..." class="postlink">Link name...</a> in every link i have class="postlink" and i want to add rel="nofollow" for every external link except my domain by check the 'href' definition. Its possible with only preg_replace with callback and how ? Example: <a href="http://google.com" class="postlink">Link name...</a> <a href="http://mysite.com" class="postlink">Link name...</a> i want to be <a href="http://google.com" class="postlink" rel="nofollow">Link name...</a> <a href="http://mysite.com" class="postlink">Link name...</a> Thanks for any help!

Member Avatar
Member Avatar
+0 forum 10

Hello! I have some i like this: `<i class="pcon" style="background-image: url(./styles/SkyBoot/imageset/topic_unread.gif); background-repeat: no-repeat;">` I want to change only this: `styles/SkyBoot/imageset` to this: `styles/SkyBoot/imageset/black` Because i have cookies and i want to create second template. I want this to change images for my black template (second theme) I try with: `jQuery('.pcon').each(function(e) {return e.css.replace('styles/SkyBoot/imageset/', 'styles/SkyBoot/imageset/black');});` but without success. I need for each element, because i have more than one. Thanks for any help!

Member Avatar
Member Avatar
+0 forum 4

My program is supposed to replace all sets of 4 spaces with a tab but it only seems to be editing the first line then skipping the rest of the lines. "work_string" is defined via another function which takes and saves an entire files input into one string. I just can't get my replacing function to act on multiple lines instead of just the first one. Here's my replacing function, anyone have an idea of how to get it to act on every line of "work_string"? def space_to_tab(work_string): s_to_tab = 4 whitespace = work_string[ : len(work_string) - len(work_string.lstrip())] whitespace = …

Member Avatar
Member Avatar
+0 forum 4

Hey, I'm trying to figure out how to get this kind of program to work, it's supposed to be a UNIX style program in the sense that everything is command line driven. What I'm trying to get it to do is when the function is called it takes the input file and converts all tabs into 4 spaces. Here's the form of the input and what I have of my tab_to_space function so far. "python3 assignment3.py +t < assignment3.py > output.txt" Where +t denotes the function that is being called Here is my function so far. def tab_to_space(): """ This …

Member Avatar
Member Avatar
+0 forum 5

I have a text file and i want to replace a word from a specific location. For example want to replace 5th word from 12th line of file. How i can do that?

Member Avatar
Member Avatar
+0 forum 3

how to `.replace()` the `'error'`? only use `a` and `b` var str = 'bla bla anything error anything bla bla'; var a = 'anything', b = a; im not good with regular expressions so im asking for how to do this with variables so i can set them up all by myself

Member Avatar
Member Avatar
+0 forum 8

Hey guys, I am having some difficulties regarding a select query logic. Then I have a table with products and it has a column -> submodel with all kind of data in it. ![3bcf9a8dac9e8218c88209198e26a7e5](/attachments/small/2/3bcf9a8dac9e8218c88209198e26a7e5.png "align-left") What I want to achieve is to **STRIP** (with REGEXP?) all the strings starting with **(** and ending with **)** and then **GROUP** all **X5** for example and instead of **7 X5's** I want to have only **1**. Is this possible directly in MySQL ? The ideea is that I cannot clean the column because the data is used in other places also.

Member Avatar
Member Avatar
+0 forum 3

Does anyone know of an easy way to have an image switch to another image when the cursor hovers over a completely separate image? [Here](http://lonnyfoster.com/temp/daniweb/replace_image.png) is a diagram that hopefully illustrates more clearly what I'm trying to say.

Member Avatar
Member Avatar
+0 forum 7

I am attempting to use preg_replace to purge everything except letters and numbers in the $_POST, however is seems to be failing to work. Sample code below demonstrating the problem. <html> <?php if( isset($_POST["name"]) || isset($_POST["age"]) ) { $x1 = preg_replace('[^A-Za-z0-9]', "", $_POST['name'] ); $x2 = preg_replace('[^A-Za-z0-9]', "", $_POST['age'] ); $_POST['name'] = $x1; $_POST['age'] = $x2; echo "Welcome ". $_POST['name']. "<br />"; echo "You are ". $_POST['age']. " years old."; } else{ $_POST['name'] = 'null'; $_POST['age'] = 'null'; } ?> <body> <form action="<?php $_PHP_SELF ?>" method="POST" onsubmit=" "> <br> Name: <input type="text" name="name" /> Age: <input type="text" name="age" /> <input …

Member Avatar
Member Avatar
+0 forum 2

Hello all, I've been set a lab assignment and am really struggling to get to grips with it. The aim to to create a "grass-roots" program that doesn't make heavy use of built in functions. Namely "string.replace()" in this case! Any ideas as to why the below code doesn't work? I've been playing around with it for a while now to no avail.. Just some background though, I only started Python a couple of weeks ago so please be gentle! def removeStopWords(text_input): line_stop_words = [] stop_words = "a","It","i","it","am","at","on","in","of","to","is","so","too","my","The","the","and","but","are","very","here","even","from","them","then","than","this","that","though" word = "" for word in text_input: word_list = string.split(text_input) new_string = …

Member Avatar
Member Avatar
+0 forum 1

I want to copy a folder full of folders to a backup on another disk. But if a duplicate filename already exists on the other disk, I want Windows to prompt to ask whether or not to replace the file for each file separately. Windows XP just gives me the option to replace all of the files or not copy the folder. Only if I copy only one folder will it prompt individual files. There are hundreds of folders in this structure, but less than 100 duplicate file names. But I don't know where the duplicates are, and do not …

Member Avatar
Member Avatar
+0 forum 9

$a = array(000,400,000,500); $b = array(300,400,450,500); $i=0; foreach($b as $k=>$v) { if($v==$a[$i]) { $b[$k]='000'; } $i++; } print_r($b); i want same thing in two dimensional array $a = Array ( [0] => Array ( [0] => 000000 [1] => 000400 [2] => 000450 ) [1] => Array ( [0] => 000350 [1] => 000400 ) ) $b = array(0=>000350,1=>000400,2=>000450) //pre-defined installment amount values

Member Avatar
Member Avatar
+0 forum 4

Array1 = array(000,400,000,500) Array2 = array(300,400,450,500) if the values of Array1 matches with Array2 values then the matching values of Array2 should be replaced with 000 i.e. Array2 = array(300,000,450,000) somebody help me. thanks in advance

Member Avatar
Member Avatar
+0 forum 2

hello i have this little image script that work on greasamonkey, the script is good and work like a charm it help me to block images i dont want to see but i wished it has interval timer becasue i run it over site with dynamic content ..the targeted pics keep changing without even press f5 /refreshing here the script ... where i should add setInterval?? // ==/UserScript== // @grant none var images = document.getElementsByTagName ("img"); var x=0; while(x<images.length) { if(images[x].alt == "category 1" || images[x].alt == "category 2") { images[x].src = "http://www.domain/IMAGES-REPLACER.gif"; } x=x+1; } thanks hope u help …

Member Avatar
Member Avatar
+0 forum 2

Hi, I am trying to create a function which takes two chars and a char* string. Then run the function and replace each occurence of Char1 with char 2. E.g. String = Apples. Char 1 = A. Char 2 = B. Char 1 is present in string so replace all occurrences of Char 1 with char 2. I've created some code for the function, but I am unable to call it: /* replace c1 with c2 in s, returning s */ char *substitute(char *s, char c1, char c2) { char *r = s; if (s == 0) return 0; for …

Member Avatar
Member Avatar
+0 forum 1

Is it possible to replace commas and spaces with commas in c#? I'm fresh in c# and am looking for guidance. Any help is appreciated! **Before:** Deleting 11 files.ABC: Total Time = 01:16:30, Remaining Time = 00:00:00 **After:** Deleting,11,files,ABC: Total,Time,01:16:30,Remaining,Time,00:00:00

Member Avatar
Member Avatar
+0 forum 5

Hi I have an issue where by I have lots of products in a field which are comma delimited I want to replace those product words with a id number that I have in a different table. I currently use FIND INSET to replace a tab to the comma but currently cant see how I would you that type to change what I need to. Here is my data EG Table 1 product_field car,boat,shirt,tie Table 2 id product_name 1 car 2 boat 3 shirt 4 tie So I need to replace Table 1 product_field with Table 2.id so result would …

Member Avatar
Member Avatar
+0 forum 12

So I have a string of the English alphabet for example. But I don't know the alphabet very well but I do know that it starts with "abc" and that it ends in "xyz". I want to remove letters "b" to "x". I want to do something like `str = str.replace("bc*x","");` or `str = str.replace("bc"*"x","");` but I don't know how I can make it work or even if whether [Asterisk](http://en.wikipedia.org/wiki/Asterisk#Computing) will work like this in JavaScript. how can I remove something like everything except for "efg" from "abcdefghijklm" without know what anything is except for "ef"?

Member Avatar
Member Avatar
+0 forum 5

Hi ! I have a column of 'City', now I want to compare the value of each cell of 'City' against the column 'City_Check'; the cell where the value matches, pick the value of 'City_ID' column & replace the city name with that ID in the 'City column'. * The Image clarifies what I want(Plz see the attachments)... I have my original data file attached as well. Regards.

Member Avatar
Member Avatar
+0 forum 5

I have a requirement to remove the use of tables and replace the code with HTML lists (<ul> and <li>). The HTML code to be replaced is as below <table> <tr><td>John Smith</td></tr> <tr><td>24 years</td></tr> <tr><td>Chicago</td></tr> </table> How to replace the above code with (<ul> <li>)

Member Avatar
Member Avatar
+0 forum 6

Assuming i have $a='1024,1025,0000|1020,0000|'; $b='1024,1025,0000,1020,0000,'; i want replace commas (,) in $b with (|) so that $b is equal to $a like this $b='1024,1025,0000|1020,0000|'; if i use $ob=str_replace("0000,","0000|",$b); echo $ob; output works : 1024,1025,0000|1020,0000| But, how to make it with PHP where did i put that this refers to the $a and what if it does not always 0000, with other purposes may be i want replace character referring to another character sequence in the array, so that $b is equal to $a, other sample : eg : $a='1024,1025,1234|1020,0000|'; $b='1024,1025,1234,1020,0000,'; output: $b='1024,1025,1234|1020,0000|'; thanks to your help. regards,

Member Avatar
Member Avatar
+0 forum 6

I have a replace button which has to replace a word that is searched inside the richtextbox(rtb).But the code is not working, help me identify my mistake. Thank you If HTMLopt.rtb.SelectedText.Length <> 0 Then HTMLopt.rtb.SelectedText = txtReplacementText.Text End If Dim StartPosition As Integer = HTMLopt.rtb.SelectionStart + 2 Dim SearchType As CompareMethod If chkMatchCase.Checked = True Then SearchType = CompareMethod.Binary Else SearchType = CompareMethod.Text End If StartPosition = InStr(StartPosition, HTMLopt.rtb.Text, txtSearchTerm.Text, SearchType) If StartPosition = 0 Then MessageBox.Show("String: '" & txtSearchTerm.Text.ToString() & "' not found", "No Matches", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Exit Sub End If HTMLopt.rtb.Select(StartPosition - 1, txtSearchTerm.Text.Length) HTMLopt.rtb.ScrollToCaret() HTMLopt.rtb.Focus()

Member Avatar
Member Avatar
+0 forum 7

Hi, I am trying to write a python func. which can replace nth occurance of any substring present in any string. For example: main_string = "badZZZZZZZZZZZZZZZZZZbadZZZZZZZZZZZZZZZZZZZZzbadZZZZZZZZZZZZZZZZZ" If I wanna replace the 2nd occurance of string "bad" with 'good' i will pass customreplace(main_string,'bad','good',2) So the Function should return badZZZZZZZZZZZZZZZZZZgoodZZZZZZZZZZZZZZZZZZZZzbadZZZZZZZZZZZZZZZZZ I have tried normal replace() main_string.replace('bad','good',2) . But its not what I wanted. Thanks In Advance,

Member Avatar
Member Avatar
+0 forum 4

A little find and replace function for PHP, not tested, but theoretically should work.

Member Avatar
Member Avatar
-1 forum 5

I am looking at http://www.w3schools.com/jsref/jsref_replace.asp and the specific example at: http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_replace3 var str="Mr Blue has a blue house and a blue car"; var n=str.replace(/blue/gi, "red"); And the result of N would be: Mr red has a red house and a red car I want the result to be: Mr Red has a red house and a red car With the first-replaced occurance to be capitalized like the original text to be replaced. Is there a way to do this?

Member Avatar
Member Avatar
+0 forum 1

Hi I have a site built on Wordpress which has a over 4,000 posts all with the suffix -2 at the end of the post name (due to me forgetting to clear the trash) before running an import). I would like to remove the -2 from the post names with a little bit of SQL so that for example my-example-post-2 becomes my-example-post and so on. The table is wp-posts and the field is post_name. I tried update wp_posts set post_name = replace(post_name,'-2',''); but this didn't work, I suspect but not sure, it may be because it looking for an actual …

Member Avatar
Member Avatar
+0 forum 2

Hey all! I am trying to write a piece of code that will replace one of my system files on reboot with a new version of that file. Hopefully someone out there has some experience with this as I am stumped at the moment. Using: VB.NET 2012 Using MoveFileEx Public Declare Function MoveFileEx Lib "kernel32" Alias "MoveFileExA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal dwFlags As Integer) As Integer Public Const MOVEFILE_DELAY_UNTIL_REBOOT = 4 Code in Form MoveFileEx("C:\windows\system32\file.name", My.Application.Info.DirectoryPath + "\file.name", 4) Resource for this API call at MSDS: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365240%28v=vs.85%29.aspx Im using flag code 4, which is MOVEFILE_DELAY_UNTIL_REBOOT. …

Member Avatar
Member Avatar
+0 forum 2

The End.