none
Using Resources in VB RRS feed

  • Question

  • I seem to be able to easily reference icons/images etc by importing them as a resource.  They show up when I use:

    My.Resources.<resource_name>

    However I've added an HTM file as a resource with the intention of assigning it to a webbrowser control but the resource does not show up using the same command ie as you type the command in the IDE, it does not offer my HTM file as one of the resources, even though it's listed right there under the Resources tree!

    Does anybody know what's special about HTM files please?

    Friday, October 5, 2018 7:50 AM

All replies

  • Hi,

    try the code:

    Dim helpHtmlFileName As String = "D:\trt.html"
            If Not System.IO.File.Exists(helpHtmlFileName) Then
                Dim buf As Byte() = System.Text.Encoding.[Default].GetBytes(My.Resources.Resource1.trt)
                System.IO.File.WriteAllBytes(helpHtmlFileName, buf)
            End If
            WebBrowser1.Navigate(helpHtmlFileName)

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Sunday, October 7, 2018 9:51 AM