Robert McLaws whines about the WindowsForms programming model, stating that “It's extremely obvious that this whole WindowsForms thing was not thought out as well as the ASP.NET side was”. Of course, this bias is based on the fact that he's coming from a web-based development environment using ASP.NET. Then, I see that Julien Ellie tries to defend the WindowsForms team, but does it in a way that makes it sound as if Robert is correct in his opinion and that the WindowsForms team didn't do as good of a job as they could have.
OK, first, when comparing ASP transitioning to ASP.NET; Microsoft obviously made some very nice design decisions and basically 100% broke free from all that is ASP 3.0. They basically started with a clean slate. Julien points this out by stating that WindowsForms had 10 years worth of legacy to deal with. In ASP.NET, the “GUI” is limited to what the browser is capable of presenting. It's a stateless world with an operating system and not able to leverage any of the advanced features that it may have to offer. Your limited to the presentation capabilities of HTML/DHTML. Not to say that's not a task in and of itself, but to compare that with the requirements and capabilities of a Windows XP application is moronic.
Robert complains that “I'm trying to cycle through a CheckedListBox to populate another CheckedListBox with the categories from the selected blogs, and there are like 9 different properties for accessing selected items." Well, what do you expect? WindowsForms is all about providing GUI options gallore... it's an extremely feature rich client. He complains about it having 9 different properties for accessing selected items... and there not being any documentation that shows how to use it.
OK, although I've never used the checkedlistbox before, follow along with me as I explore Roberts angst.
First, I type in the following code... thinking it would give me what I'm looking for (or at least close).
For Each item As String In CheckedListBox1.CheckedItems
Highlighting CheckedItems and pressing the F1 key, VS.NET brings up the help for the CheckedItems collection. Scrolling down, low and behold, here's the sample it provides:
Private Sub WhatIsChecked_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
' Display in a message box all the items that are checked.
Dim indexChecked As Integer
Dim itemChecked As Object
Const quote As String = """"
' First show the index and check state of all selected items.
For Each indexChecked In CheckedListBox1.CheckedIndices
' The indexChecked variable contains the index of the item.
MessageBox.Show("Index#: " + indexChecked.ToString() + ", is checked. Checked state is:" + _
CheckedListBox1.GetItemCheckState(indexChecked).ToString() + ".")
' Next show the object title and check state for each item selected.
For Each itemChecked In CheckedListBox1.CheckedItems
' Use the IndexOf method to get the index of an item.
MessageBox.Show("Item with title: " + quote + itemChecked.ToString() + quote + _
“, is checked. Checked state is: " + _
CheckedListBox1.GetItemCheckState(CheckedListBox1.Items.IndexOf(itemChecked)).ToString() + ".")
But, there's not samples? And it takes 9 properties to get the what items are checked? Using the above sample, you could get a list of checked items and their current states by doing the following:
For Each item As String In CheckedListBox1.CheckedItems
I count ONE property (the collection of CheckedItems)!!!!!!! Simply because he’s not familiar with WindowsForms programming model, he assumes its inferior to WebForms. This is a joke. Also, I think Julien politically correct response is somewhat pathetic. He starts off by saying that what he’s about to say is his personal views, but doesn’t point out that Roberts complaints are slightly unfounded. <p>Should the two models be closer together? Let me put it to you this way. In order for that to happen, WindowsForms would have to be extremely ‘dumbed down’. So my answer is a huge resounding NO!!!!!! Julien points out that Longhorn and WinFX will help to bring the two closer together, but that still will not change the fact that deploying an application with the presentation layer being an internet browser being nothing more than a dumb terminal in comparison to the capabilities that a WindowsForms application can provide. Is it going to be a little more complicated to develop than a WebForms application, of course it is. With added capability comes added complexity. Just look at ASP.NET WebForms vs ASP 3.0. ASP.NET, although more elegant and flexible, is a lot more complicated to develop and application than throwing a little VBScript into some HTML that ASP 3.0 offered.</p> <p>WindowsForms, although it does have it’s problems, is worlds apart from developing Win32 application using anything previously available. To say that Microsoft didn’t do their job because the two models are closer together is moronic at best, idiotic at worst. The two are different. Even when Longhorn is available, developing internet browser based applications will still be limited to the features that browsers expose. Longhorn is 3-5 years away and will offer a world of difference, however I don’t see the other browsers coming anywhere close to anything that WinFX will be offering. Even if they did, you’d still run into the issues you have today with browser differences and still be relegated to targeting the lowest common feature sets across targeted browsers.</p> <p>You don’t have that problem with WindowsForms… if you want to design a completely new user interface using DirectX as a display engine, you can do so (examples: Windows XP Media Center Edition applications using .NET 1.0/DirectX and Terranium). Complicated? Yes. An option with WindowsForms? Yes. An option with WebForms? Not in your wildest dreams. Even application that try to mimic the Windows look and feel are a bit quirky and just this side of experimental limited to a certain browsers that support ‘advanced’ or ‘standard’ features. The only ‘standard’ in the browser space is that everyone implements their own version of the ‘standard’.</p> <p>So in the end, Robert points out that it’s complicated and not documented. As you can see, it’s not complicated and there is documentation. All I did to find it was press the freakin’ F1 key. Oh wait, maybe that’s the problem. Pressing the F1 key in a browser doesn’t give you context sensitive help for the web-based application that your running ;-)</p>