473,320 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Using Web Forms vs Windows Forms

HI,
I have just started using Web Forms. It seems that I'm not able to do
some things that Windows Forms allow me to do. For example, I tried to
implement a counter using a module level declaration, but it would not
increment using Web Forms.

Also, some controls such as textboxes, which worked OK on the computer,
did not work when I placed the project on the server and accesed it via
the internet.
Dec 10 '07 #1
5 1338
Reds,

What is new about that, why would somebody use winforms instead of webforms
as this was not as you wrote.

Webforms will allways use a kind of HTML and Javascript beside all kind of
other addons. It is a complete different technique to use. Although that
there have been and still is tried to evolt that to a situation were you can
develop for one and use only the winforms design.

Cor

"Reds" <re*******@hotmail.comschreef in bericht
news:re*****************************@newsclstr02.n ews.prodigy.com...
HI,
I have just started using Web Forms. It seems that I'm not able to do
some things that Windows Forms allow me to do. For example, I tried to
implement a counter using a module level declaration, but it would not
increment using Web Forms.

Also, some controls such as textboxes, which worked OK on the computer,
did not work when I placed the project on the server and accesed it via
the internet.
Dec 10 '07 #2
Keep in mind that a web form is created during the http request and then
deleted. Is is totally recreated for each new request (the idea is that as
we don't know if the user will ever ask something again to the server we
don't want to keep a fair amount of useless data for each user). So you
can't create a private member on a form and increment it. It will be lost
(as the form is created each time)

You'll have to read a bit more about how the web works. Try around :
http://msdn2.microsoft.com/en-us/lib...c5(vs.71).aspx

For point #2 :
- doesn't work doesn't mean anything to us. What do you really see ? The
usual trap is to perfom something server side and thinking it works client
side or the other way round. It doesn't matter when the server and the
client is the same machine but once you are in a real world environment you
see it doesn't work anymore.

---
Patrice
"Reds" <re*******@hotmail.coma écrit dans le message de news:
re*****************************@news....p rodigy.com...
HI,
I have just started using Web Forms. It seems that I'm not able to do
some things that Windows Forms allow me to do. For example, I tried to
implement a counter using a module level declaration, but it would not
increment using Web Forms.

Also, some controls such as textboxes, which worked OK on the computer,
did not work when I placed the project on the server and accesed it via
the internet.

Dec 10 '07 #3
Both previous posters were right about web forms.

They're basically HTML/Javascript pages (generated by ASP, but to the web
browser they're just HTML/Javascript) where the details are abstracted from
you so you can't see them. I honestly never liked (and never really spent
the time to learn) writing web pages ("web forms") with ASP.NET or even ASP
because I really didn't like the model. I prefer PHP for pages that run on a
web server, but that may be a little harder to code if you're just learning
the language and tools/libraries available for that.

Honestly, if you are targetting a specific customer or doing an in-house
project, I think the Visual Studio 2008 "WPF Browser App" (or called
something similar) which I'm now learning to use is so much nicer, and gives
you most of the functionality of the windows-based equivalent. I actually
host the WPF Browser app on my Linux-based (non-microsoft/windows) server and
the code on the server-side to access the database for me is PHP code -- only
the user interface is Microsoft-technology (.net 3.5).

The biggest problem with this approach, of course, is .net 3.5 is about a
30-minute installation- convincing my users to do this download may be
impractical, but once it's there, in theory, it's there for good. I'm hoping
Microsoft will eventually start forcing .net 3.5 on users via automatic
updates or better yet, a service pack. This will make my life easier in
terms of convincing my users to use the web app rather than download the
standalone .net 2.0 app which accesses the same database.

-Rob
"Reds" wrote:
HI,
I have just started using Web Forms. It seems that I'm not able to do
some things that Windows Forms allow me to do. For example, I tried to
implement a counter using a module level declaration, but it would not
increment using Web Forms.

Also, some controls such as textboxes, which worked OK on the computer,
did not work when I placed the project on the server and accesed it via
the internet.
Dec 10 '07 #4

"Reds" <re*******@hotmail.comwrote in message
news:re*****************************@newsclstr02.n ews.prodigy.com...
HI,
I have just started using Web Forms. It seems that I'm not able to do
some things that Windows Forms allow me to do. For example, I tried to
implement a counter using a module level declaration, but it would not
increment using Web Forms.

Also, some controls such as textboxes, which worked OK on the computer,
did not work when I placed the project on the server and accesed it via
the internet.
Welcome to the wonderful world of ASP.NET.

First off when you have questions about ASP.NET I would suggest you post
them to the microsoft.public.dotnet.framework.aspnet newsgroup. They are
more likely to know what you are asking since most of the question will be
about ASP rather than VB.

What you saw is the first thing to learn about ASP.NET. The net is
stateless. This means that without you doing something to save the
information between posts it will be lost.

The second as stated in other posts here is that regular windows controls
are not used in web pages. When you look at the toolbar in either VWD or VS
you will see the web controls. There is not a one to one from web to
windows forms.

Now as a starter lets look at what you did (my supposition).

Lets say you create a web page with a label and a button. You have a
variable to hold the count and each time you click the button you want the
count to increment and you will show the new total on the label. As you saw
when you get the button click the variable is set to whatever you set it to
be in the declaration.

dim _total as integer = 0.

That will ensure that each time you get the button click event the variable
total will be zero. How do you get around this? There is a mechanism
called Session which can hold the information you want save between
postings. It is a simple dictionary so when you go to the click event the
code would look something like:

if session("total") isnot nothing then
_total = session("total")
end if

What this does is see if the session variable ("total") has been set up. If
not you are on your first go around. If this is a postback will then return
the value you saved (in a minute) and you can then increment the _total
variable and save it back to the session.

_total +=1
session("total") = _total

This is a very simplified example. I would suggest the first thing you
investigate is what is called the life cycle of an asp.net page. Without
knowing this you will most likely spend a lot of time scratching your head
about what has happened.

Now go to http://www.asp.net/learn/videos/

There are about 50 video tutorials on this page. I spent the time and it
was well worth it. Without those videos I might not have any hair left.

Good luck
Lloyd Sheen

Dec 10 '07 #5
Thanks
Dec 11 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: grutta | last post by:
I am writing a windows service that will recieve notification when a USB Device is insterted into the machine. I have used the RegisterDeviceNotification and the RegisterServiceCtrlHandlerEx with...
5
by: Dave | last post by:
I tried posting this in the WinForm forum and got no hits so I am trying it here. After inserting a new data row to a DataTable that is bound to a datagrid, I am unable to change data in a row...
1
by: Jason Hickey | last post by:
Has there been a change in the way the UI designer handles winform inheritance in the 2003 version of visual studio. Consider the following (try it if you are using 2003 Everything seems to work...
0
by: Marco Segurini | last post by:
Hi, I am trying to dynamically install/deinstall a message handler to a System.Windows.Forms.Form using NativeWindow. I do not use IMessageFilter derived class because it intercept only the...
2
by: Hrcko | last post by:
How to use this control? I have to grids on my form, one on the top and one on bottom. When I start application I want to be able to move bottom grip up, and top grid down, but it doesn't...
3
by: Rob | last post by:
Hi all, I am having trouble converting the code below (found on http://vbnet.mvps.org/index.html?code/core/sendmessage.htm) into a format that will work using vb .NET. Can anyone have a look...
2
by: Carl Gilbert | last post by:
Hi I have a math kinda problem where I'm trying to split some lines when two or more lines connect two shapes. The reason I am doing this is to make it clear that there are multiple lines...
3
by: Siv | last post by:
Hi, A little while ago I wrote a small program that allowed the user to view products from a database. The database holds the details of the products which can be viewed via a form and...
0
by: Sister Ray | last post by:
I'm trying to create a simple form that sends an email using my company's exchange server. I'm using the System.Net.Mail Namespace of the .net framework 2.0. I've googled everywhere and i think my...
3
by: shobhitguptait | last post by:
How to Run C#.NET Windows App on N/W with centralized DB using SQL SERVER 2000 Hello All...i m really grate full to c such a website where developers try to help people like us who face problems...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.