[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Change the file extension from .html to .mht

hi experts,
  I m developing one small application in vb.net which should work in the following way.
     I do have on textbox & one command button on my form. What i wanted do is, I will type some url's in that textbox with extension .html, Whenever i will press the command button the url's that i have typed, should convert their .html extension to .mht & should get saved in my hard drive ie it should search a pages from the net that i have typed & should save that pages with .mht extension.

Anybody having idea plz help.

it's urgent

thanx
0
s_monani
Asked:
s_monani
  • 3
1 Solution
 
jalalmegadethCommented:
so if i understood your question, u want a script that finds the .html, and replaces it by .mht

it's kind of find and replace

take a look at this page, you may find the answer :
http://www.codeproject.com/useritems/findandriplace_rtb.asp

and here's the function you may need :



Public Class RichTextBoxFR
    Inherits RichTextBox
   
    Public Sub FindAndReplace(ByVal FindText As String, ByVal ReplaceText As String)
    Me.Find(FindText)
            If Not Me.SelectionLength = 0 Then
            Me.SelectedText = ReplaceText
            Else
            MsgBox("The following specified text was not found: " & FindText)
            End If
    End Sub
   
End Class


GL


0
 
s_monaniAuthor Commented:
thanx for reply sir,
  But it is not exactly i wanted. This code will just replace the specified string to other.
Let u have one example.
  Consider i m opening www.yahoo.com page in browser, So by using my application it should save this page with .mht extension.
 I hope u have got it now
thanx
0
 
s_monaniAuthor Commented:
Thanx it's working great

Thanx again
0
 
s_monaniAuthor Commented:
hi hclgroup,
 One problem has arose in that code.  This code saves the home page to the harddisk, means if i will save the file, then it saved in the format of .mht, but when i opened it, it direclty opens the live page of that file, means it do not open it from myh harddisk.  For example, i m saving the the google page file in the google.mht  format in my c drive (c:\google.mht), but when i open it, the address in the address bar is www.google.com instead of c:\google.mht.  I don't want in this format. Is there any other way out.

Plz help.
plz send me the solution at subunotes@yahoo.co.in as soon as possible. It's urgent
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now