Winforms: ListBox vs. ListView

Had some discussions about Lists and controls, like Listbox and Listview, and sometimes its difficult to distinguish those.

System.Windows.Forms.ListView

  • Inherits from Control
  • Represents a Windows list view control, which displays a collection of items that can be displayed using one of four different views
  • Windows Explorer like
  • Wrapper of the standard Win32 list view

more control over appearance
4 different view styles: iconview, small icon-view, list-view, details-view (report-view)
image   image   image   image

Multiple columns are possible
image
property Multicolumn = true
 

Heavier than the listbox

Has no DataSource property, Items must be added to Items property and must be ListViewItem

No design-time databinding,  -->  maybe an advantage :-)

 Msdn Link
http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.aspx

 

 

System.Windows.Forms.ListBox

  • Inherits from ListControl, common impl. for Listbox and ComboBox
  • Represents a Windows control to display a list of items

Datasource property can be used for databinding

More lightweight

Simple to use --> Use DataSource, or add your items to Items property

Msdn Link
http://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.aspx

 

Essence

In very simple scenarios use Listbox or ListView, but try to use the DataGridView, or even a datagrid from a third vendor.

 

There exists also a rule from SSW on this.

Do Do you always use GridView instead of ListBox?

Chrome vs. Opera - Zoom Feature - Opera winner!

 image
Bad Example - Chrome resizes the text, but not the container of the text (divs, tables,...)
See the large white unused space.

 

 

image
Good Example - Opera resizes the whole page, uses whole screen.

 

 

The Page where screenshots are taken, is Google Chrome blog

Opera vs. Google Chrome - Usability perspective

 

image
Bad Example - Opera has too many options to configure it, for the standard user. (No chance to find a setting)

 

image
Good Example - Chrome assumes many settings. (Brainstorming in Google Labs?)

 

In Opera we have 5 tabs, (14 tabs under the advanced tab), that makes: 5+14 -1
= 18 tabs with options to configure.


In Chrome (Beta 0.2.149.29) we have 3 Tabs with options to configure.
Maybe the Google Chrome Team adds more oft them later, but the essence is:
The Usability team has researched how the browser should work and behave,
all settings that makes sense to configure are there.
No options the users doesn't care about!

 

And that follows the 2nd major usability rule from Joel.
Yes, i like them a lot!! :-)

From Joel Spolsky first UI book. 

Every time you provide an option, you're asking the user to make a decision.

 

 

 

 

Notes:

Chrome is the browser release from Google, based on Chromium. Chromium is the open source project.
More details on that on Wikipedia Chrome

Response.Redirect vs. Server.Transfer vs. Server.Execute

My quick recap!

Response.Redirect(string url)

  1. Sends a HTTP 302 to the client browser
  2. Client browser does a HTTP-GET of that new page
    That's it.

Note to Redirect Method
Take a look at System.Web.HttpResponse.Redirect in Reflector and see how MS creates a hardcoded html, head, body construct... :-)


Before we meet Server.Transfer meet:
Server.Execute(string page)

  1. Executes the other page
  2. Control-flow jumps to new page and
  3. Returns back if finished...




Server.Transfer(string path)

  1. Sends all of the information that has been assembled for processing by one .aspx file to a the parameter path (.aspx page).


Insight to Server.Transfer
Server.Transfer does a Server.Execute(path, null, true);
but with a Response.End after return from Execute
last param = preserveForm





Advantages of Response.Redirect
Good Can redirect to external urls (even .html or classic asp-pages)
Good Url of new page is in browser adress bar
is this an advantage? :-)

Advantages of Server.Transfer
Good Server.Transfer can pass variables with HTTPContext.Items
Good PreviousPage property access is possible
Good Better performance cause no Client activity is involved
Bad Server.Transfer bypasses the authorization for the page you redirect

References
http://www.dotnetframework.de/dotnet/aspnet2/RedirectVersusTransfer.aspx

http://codebetter.com/blogs/darrell.norton/archive/2003/08/26/1270.aspx

http://weblogs.asp.net/jgalloway/archive/2004/07/21/189547.aspx

http://techahead.wordpress.com/2007/10/14/aspnet-servertransfer-vs-responseredirect/

Latest Posts

Popular Posts