Webpage look UI in WindowsForms applications

  • Thread starter Thread starter Matt Osborne
  • Start date Start date
M

Matt Osborne

Good afternoon all!

I am wondering if it is possible to somehow host ASP.Net inside an
executable or do something similar. I am wanting create a UI similar to
that of TurboTax or Microsoft Money or any of the other growing number of
applications that rely on a UI that is similar to a webpage. I would like
to be able to design the UI and render the UI as HTML for ease of updating
and changing via CSS. I have seen some information about HTA but have not
been able to find any documentation about it and C#. My ideal solution
would be to host an ASP.Net web application in an executable.

Thanks for your help
 
well you probably dont have to go to that extent...

You can simply embed a web browser in your app..


create a new winforms project.
right clikc on the toold back and selected add
Then select COM objects...
Find microsoft web browser. and select OK

It will now appear on the toolbox.... simply drag it onto your form and vs
will create all your com wrapper code that is needed.

Then simply load .htm files...

just do a search on google for axWebBrowser as this is the com wrapper that
is created
http://www.google.com.au/search?hl=en&ie=UTF-8&q=axWebBrowser&meta=
 
Thanks for your reply.

That would definately let me display HTML in a windows form, however, this
does not solve my bigger problem. Creating an application with a C# backend
and an HTML front end. I would like the ablity to use C# to access
databases, web services and possibly much more while using an HTML based UI.
ASP.Net is exactly what I want but i do not want to require IIS or some
other web server technology and I also do not want to require a connection
to the internet or for the application to be hosted in IE. I have some
dialogs that i want to show that would be impossible with just HTML or IE.
 
What do you need from asp.net that you CANT do in a windows form?
More to the point... what do you need from asp.net that you CANT do just
using HTML as the UI and then C# as your access code

think of the browser as just being you UI... and ONLY the UI....

You can interact with the HTML just as you would a windows app...

eg, you can fire events in HTML that you simply catch in you c# code.

some examples are here http://www.devx.com/vb2themax/Tip/18798

you can also then execute script inside the browser from c# also..
 
Darren:

Thanks again for your response. The features from ASP.Net that I would like
is the ability to seemlessly intergrate the HTML frontend from the C#
backend. The development of the UI would be so easy in ASP.Net, much easier
then using the browser object events. ASP.Net allows you to create objects
the "draw" themselfs with HTML and easily get on click and on change events.
Your last post was very usefull, but it still seams like their should be an
easier way.

Thanks again
 
Matt,

In .NET you can code your entire frontend in XML which will then be
parsed at runtime. This method uses XML to interface with your entire
UI -- not just a content area drawn on a form. With this technology,
you could use XSLT to interact with your forms in real time. Depending
on how you view this technology, this could be both good and bad. Take
a look at this article; it might be just what you're looking for:

http://windowsforms.net/articles/wfml.aspx

As a side note, this is supposed to be the future of Windows forms in
Longhorn. XAML, the XML Application Markup Language, will do,
essentially, what this article is demonstrating only to a whole other
level. It allows you to define your Windows forms in XML allowing them
to be dynamically drawn at runtime.

If your goal is not to have your entire UI dynamic, but rather just a
part of it, I would go with Darren's approach and embed a browser
control on your form.
 
THis isnt making sence now.

say you did write a app that used asp.net, and you wanted to embed the
webbrowser INSIDE a windows form.

The events that are raised will always be to the SERVER, e.g. the asp.net
engine. NOT your code in the windows form.

So why do you need to embed it in the windows form? as you cant catch
asp.net events.... you can only catch HTML OBJECT events like onclick,
onchange,onproperty change etc.

So that being said... that if you are using asp.net you wont catch those
events from your windows form.... BUT you want a HTML style interface. The
only thing left is to embed a web browser into a windows forms application
and then learn to ref all the HTML objects through code.(I wish i had some
code examples here of catching the HTML events and executing script on the
html pages that is called from c#, we worked on a project last year that was
like that.)

I remember that www.devx.com had an article on this a few months ago that
was quite informative.
 
i made a similar thing work with the php.exe - parsing all server
requests.
maybe this can be done if asp.net can run like cgi - if not then using
php.exe, or a custom exe that uses a request and response ould do the
trick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top