Results 1 to 15 of 15

Thread: Opening an HTML page with button click

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    4

    Opening an HTML page with button click

    Hello

    I want to display information in my database, not in a datagrid or other control, but in an HTML page.
    What is the easiest way of achieving this?


    Thanks

  2. #2
    Addicted Member
    Join Date
    Feb 2003
    Posts
    183

    Re: Opening an HTML page with button click

    Depends what the information you are trying to display is. Normally, if you want information from your DB, you would write an ASP/ASP.NET page to access the relevant information and display it.

    You would then place a web browser control on a form and use the navigate method to go to the page you created.

    HTH
    Look into the heart of infinity and find your truth

    Colonel Tom Edwards: This is the most fantastic story I've ever heard
    Jeff Trent: And every word of it's true, too
    Colonel Tom Edwards: That's the fantastic part of it

    ROFL

  3. #3
    New Member
    Join Date
    Jul 2005
    Posts
    4

    Re: Opening an HTML page with button click

    Dim oProcess As Process
    oProcess.Start("http://www.vbforums.com")

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Opening an HTML page with button click

    You could just use the streamwriter to create a html file from the data from your db. Then use the process object to start it in a browser.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Opening an HTML page with button click

    Drop winforms and move to webforms instead.

  6. #6
    Junior Member
    Join Date
    Aug 2006
    Posts
    22

    Re: Opening an HTML page with button click

    Quote Originally Posted by RobDog888
    You could just use the streamwriter to create a html file from the data from your db. Then use the process object to start it in a browser.
    Hello RobDog, this is exactly what I need to do...but HOW? I have a HTML file in a IsolatedStorage and want to show it in the browser. Which method would be suitable?
    Thank you a lot.
    Ravie.

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Opening an HTML page with button click

    VB Code:
    1. Dim oProcess As Process
    2. oProcess.Start("C:\MyFile.htm")
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8
    Junior Member
    Join Date
    Aug 2006
    Posts
    22

    Re: Opening an HTML page with button click

    Quote Originally Posted by RobDog888
    VB Code:
    1. Dim oProcess As Process
    2. oProcess.Start("C:\MyFile.htm")
    Thank you, RobDog. Unfortunately, I do not know the file's path, because it is stored in Isolated storage mode:

    Dim writer as new StreamWriter (New IsolatedStorageFileStream("ia.htm", FileMode.Create, isostore))
    writer.writeline....
    writer.close()

    Is there a way around this?
    Thank you very much.
    Ravie

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Opening an HTML page with button click

    You could use a browser control in your own app rather than spawning an external process. If you have the HTML code in a string then you can assign it to the DocumentText property of the WebBrowser control. If you're using .NET 1.x (please specify in future) then I'd imagine that the ActiveX Web browser would have something similar.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10
    Junior Member
    Join Date
    Aug 2006
    Posts
    22

    Re: Opening an HTML page with button click

    Hello jmcilhinney,
    I'm using .NET 1.x, but as I am not very experienced in VS.2003, I'd need something simple, if possible, or an example . I just realised that even the RobDog's solution is not suitable for this, because I am developing a Sharepoint WEb Part and even when using oprocess.Start("C:\file.htm") I get a web part error, damn it :-/.
    I fear I'll have to learn how to debug web parts :-)
    Thank you very much.
    Ravie

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Opening an HTML page with button click

    I have no idea how Web Parts work. Having read your first post again I realise that my suggestion violates your "other control" condition anyway.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  12. #12
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Opening an HTML page with button click

    Allow me to gracefully repeat myself: Use webforms. In other words, use ASP.NET. Unless that is what you are already using in which case you should have mentioned this earlier.

    I am guessing that you are already using ASP.NET, because you've mentioned SPS Webparts, and are looking to display some information from a database. You have many options to do so, you only need to read up on some ADO.NET and you can use gridviews/datagrids to display the information.

  13. #13
    Junior Member
    Join Date
    Aug 2006
    Posts
    22

    Re: Opening an HTML page with button click

    Quote Originally Posted by mendhak
    Allow me to gracefully repeat myself: Use webforms. In other words, use ASP.NET. Unless that is what you are already using in which case you should have mentioned this earlier.

    I am guessing that you are already using ASP.NET, because you've mentioned SPS Webparts, and are looking to display some information from a database. You have many options to do so, you only need to read up on some ADO.NET and you can use gridviews/datagrids to display the information.
    Hello Mendhak,
    I don't need to use datagrids and stuff like that, because I have to print a formatted output. This is why I use HTML. Other option would be to use MS Word - but I am not sure whether Word can be forced to import html code via VS.NET.
    Thank you.
    Ravie.

  14. #14
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Opening an HTML page with button click

    How is Webparts related to this then? You say you're getting a web parts error, explain that again in more detail.

  15. #15
    Junior Member
    Join Date
    Aug 2006
    Posts
    22

    Unhappy Re: Opening an HTML page with button click

    Quote Originally Posted by mendhak
    How is Webparts related to this then? You say you're getting a web parts error, explain that again in more detail.
    I am getting the data from the DB into a Web part. The Web parts are difficult to debug, so I am working via "build-display web part-edit code-build-display...", so the Web Part either works correctly or throws an unspecified error.
    I need to open an HTML code, which I have in a web part String variable, in a new browser window - that's all, but it doesn't seem to be simple at the moment

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width