How to replace an Image with Text?

Asked

Viewed 158 times

2

I am developing a project where I need to replace an image with a certain text when it is not loading.

Example: If the image does not click, display a message stating that the image could not be downloaded. Is this possible? My image is emerging within a RichTextBox, together with text.

  • In this case you want something that is done directly with VB.net or this check can be in Javascript for example?

  • Preferably it would be something to do in VB.net code, but if there is a solution in Javascript that allows me to put the code in operation, it will also serve

1 answer

2


I found the answer to my problem in the stack overflow in English. This case worked for what I needed: Answer

If you do not want to navigate to the link, here is the piece of code:

    Dim input As String = "test<img>" ' your data here
    Dim imgRegex As New Regex("<img[^>]*>", RegexOptions.IgnoreCase)
    Dim output As String = imgRegex.Replace(input, "")

Browser other questions tagged

You are not signed in. Login or sign up in order to post.