2005-06-22

Article on Cheesman Canyon by Pat Dorsey

I just read a fantastic article in my September 2005 issue of FlyFisherman Magazine


Guide and fly tier Pat Dorsey shares his time-tested secrets for fishing to
the toughest trout in Colorado. This story includes a season-by-season
description of Cheesman Canyon, including hatch information, fly pattern
suggestions, and fishing strategies. Map, fly shops, and guide contact
information is also included.


It is an exerpt taken from his book which I am anxious to read:

A Fly Fisher's Guide to the South Platte River: A Comprehensive Guide to Fly-Fishing the South Platte Watershed

and it is available at the Blue Quill Angler in Evergreen, CO

2005-06-21

Parent-Child combo boxes in C#.NET Windows Forms

I was fighting with a pretty simple scenario in a C#.NET Windows Forms project today. I was having trouble getting data binding to behave the way I wanted it to. I'm sure that other people have the same requirements in some of their apps: parent and child combo boxes.


  1. Bind controls on a form to a dataset called dsAddresses in this example. The parent and child SelectedValue are bound to CountryRegionID and StateProvinceID from this dsAddresses dataset.
  2. Populate the parent and child combo box items with data from country/region and states/provinces datasources (DataTables in this example) respectively
  3. When the parent combo box's selected value changes, have the items in the child combo box filtered automatically
This sounds pretty simple and like something that many of us would need to accomplish on a regular basis in both Windows Forms and ASP.NET Web Forms.
Well...I had a solution that was acceptable for the most part, but there was an few issue with the way that I implemented the solution.

Main issue: If you brought up the form and selected an address, the values in the parent and child combo boxes were bound to the correct values, but if you didn't select a country/region (which causes the SelectionChangeCommitted event to fire and this is where I called a method to filter the state/provinces manually in my previous solution) in the parent combo, the states/provinces combo would not be filtered and all states/provinces would show up.

I tried a number of workarounds and was about to scrap the entire original design of the form and start from scratch.

Brad Raulston gave me a hand and we tried a few things and then he researched it and found a blog posting by Andre King:

Parent-Child combo boxes in C#.NET Windows Forms

It detailed a scenario almost exactly like the one outlined above. I can't seem to get to the link at the moment but I was able to get the cached Google version.

Brad graciously helped me with the solution below:

Created a dataset called dsCountryState.
Merged 2 DataTables into it (because I already had them, but will refactor
to fill the dataset with both tables in one shot for efficiency later): one for
the parent Country/Region data and one for the State/Province data.

// Created a DataRelation for the parent and child DataTables like this:
DataRelation rel = new DataRelation("CountryStateRelation", dsCountryState.Tables["CountryRegion"].Columns["CountryRegionID"],
dsCountryState.Tables["StateProvince"].Columns["CountryRegionID"]);

// Accept Changes on the dsCountryState DataSet.
dsCountryState.AcceptChanges();

// parent combo bound to the
"parent_datatable.parent_column"cboCountryRegion.DataSource =
dsCountryState.Tables["CountryRegion"];

cboCountryRegion.DisplayMember = "CountryRegion.CountryRegionName";

cboCountryRegion.ValueMember = "CountryRegion.CountryRegionID";

// child combo bound to the "parent_datatable.parent_child_relation.child_column" cboStateProvince.DataSource = dsCountryState;

cboStateProvince.DisplayMember = "CountryRegion.CountryStateRelationship.StateProvinceName";

cboStateProvince.ValueMember = "CountryRegion.CountryStateRelationship.StateProvinceID";


What this accomplishes among other things is the combo boxes share
the same BindingManager which enables the required behavior. States/Provinces
are filtered automatically.

Thanks to Brad Raulston and Andre King for
the help and information. Hope this saves you some time and frustration.

2005-06-09

History of Fly Fishing

Interested in the history of Fly Fishing? I came across a great site dedicated to the history of Fly Fishing. It was put together by Andrew N. Herd. The site is available at http://www.flyfishinghistory.com/.

Here is an excerpt on the origins of fly fishing:

The first reference to fly fishing is in Ælian’s Natural History, probably
written about 200 A.D. Ælian was born in about A.D. 170 at Praeneste, where he
later held a religious post, dying in about A.D. 230. At some point he became a
pupil of Pausanias of Caesarea, who taught him rhetoric, and as a good student
Ælian also learnt excellent Attic Greek. He later studied history under the
patronage of the empress Julia Domna, and moving within her circle would have
allowed him to meet not only Galen, but Oppian.


Here is a history of hooks:

The hook had its origins in the gorge, a device used by many primitive cultures,
which is frequently found in prehistoric sites. Gorges were made from slivers of
bone, flint or turtle-shell which were attached to a line which was knotted
through a hole in the centre of the gorge. The fish swallowed the gorge end
first in a bait, and the pull of the line levered the gorge across the fish’s
throat, trapping it in place...


There is a lot more interesting information available at the site. Check it out!

2005-06-08

GMAIL Invites

Don't have a GMAIL account?

I've got 50 GMAIL invitations if anyone is interested. Just leave me a comment with your email address and I'll send you one.

2005-06-07

The RegexLibrary Builder for .NET

I just found this article on The Code Project. One
of the coolest things is that you can add, remove, and modify regexes
from a compiled assembly, so you fix or replace regexes without having
to recompile the entire project. It makes use of the CompileToAssembly
method in the System.Text.RegularExpressions namespace.


==================
Here is a link to the article by Brian Delahunty:
http://www.codeproject.com/useritems/regexlibbuilder.asp


The RegexLibrary builder allows you to:


Create CLS compliant Regular Expression Libraries - .NET assemblies
that contain only regular expressions
Add multiple regular expressions to a single assembly
Define individual names, namespaces, regex modifiers, and accessibility
levels on a per regex basis
Reload existing Regular Expression Libraries and add, remove, or modify
regular expressions contained within
Manually set the version number of the assembly to help ensure
compatibility with existing versions
Much, much, more... ;-)


Here is a link to the author's (Brian Delahunty) blog posting on the
tool: http://briandela.com/blog/archive/2005/06/03/284.aspx