# Thursday, April 22, 2004
CodeDom Article

I know that it's not a really big deal to many authors, but I got my first article published on the Fawcette Reports web site.

I didn't know that it was actually published until I started getting emails about it - but it's linked below.


Articles
Thursday, April 22, 2004 1:53:43 PM (GMT Standard Time, UTC+00:00)  #  Comments [0] 

# Tuesday, February 03, 2004
Databinding on the Compact Framework

Through careful use of databinding, your UI code can be very light weight.

There are two forms of databinding that we need to discuss, binding to properties of objects and binding to a list of objects – which often binds to properties of the individual objects.

First, let’s deal with the less talked about binding to properties. The code to setup a binding to a particular property on an object is fairly simple. The following snippet binds the text property of the _txtName textbox to the name of a person.

 

_txtName.DataBindings.Add("Text", person, "name");

 

This assumes several things. First of all, it assumes that the TextBox has a Text property. Second, it assumes that the person is not null and lastly, that the person has a valid property called name. Once you work through those assumptions, the TextBox in question will not only show but allow you to edit the person’s name with that one line of code. If, however, instead of a person object, you have a table with rows of people, you will bind as follows.

 

_txtName.DataBindings.Add("Text", _dataSet.Tables["person"], "name");

 

As a quick note, on the full framework, I would bind the text as follows.

 

_txtName.DataBindings.Add("Text", _dataSet, "person.name");

 

However, this is a shortcoming of the Compact Framework in that it is not able to bind to expressions like “person.name”.

 

Back to the original thought, as this is a simple textbox, this is only able to bind to one row at a time so it’s going to enlist the BindingManagerBase for the form to pick which row is bound. The BindingManagerBase controls the databinding for a particular object for all of the bound sub-controls of the control from which it was returned. Most often, it is used to control the bindings for an entire form, as I’ve done in the sample, but it can also be used on a particular Tab or Panel. To get the BindingManagerBase, use the BindingContext for the container in question to retrieve it as follows.

 

BindingManagerBase _bindingManager = null;

_bindingManager = this.BindingContext[_dataSet.Tables["person"]];

 

At this point, you can use the BindingManagerBase to control the position in the list and thus the current row bound by the TextBox by setting its Position or to monitor changes to the object by subscribing to the CurrentChanged event.

 

BindingManagerBase _bindingManager = null;

private void Bind()

{

            _bindingManager = this.BindingContext[_dataSet.Tables["person"]];

            _bindingManager.PositionChanged +=

                      new EventHandler(_bindingManager_PositionChanged);

_bindingManager.CurrentChanged +=

         new EventHandler(_bindingManager_CurrentChanged);

 

            _txtName.DataBindings.Add("Text", _dataSet.Tables["person"], "name");

            _txtEmail.DataBindings.Add("Text", _dataSet.Tables["person"], "email");

}

private void _btnNext_Click(object sender, System.EventArgs e)

{

            _bindingManager.Position++;

}

private void _btnPrevious_Click(object sender, System.EventArgs e)

{

            _bindingManager.Position--;                   

}

 

This will allow you to cycle through the list easily.

 

The second form of databinding, binding to lists, is even easier. The code is as follows.

 

private void BindList()

{

            _lstMain.DataSource = _dataSet.Tables["person"];

            _lstMain.DisplayMember = "name";

}

 

Setting the DataSource on the list requires that the list (or table in this sample) implements IList or IListSource, which the DataTable does. Setting the DisplayMember is similar to the binding of the properties that we did earlier in that it will show the name column or property on the person object or row in the list.

 

There are some benefits to combining these methods of databinding. For example, if you bind the table to the list and bind the textbox to the same table – the listbox will automatically keep track of the positioning of the BindingManagerBase.

 

In conclusion, there is very little need to write a lot of UI code anymore. Instead, leverage databinding to your advantage to keep your UI lightweight and responsive. 

 

For a full code listing download the sample code below.


Development
Tuesday, February 03, 2004 10:02:14 PM (GMT Standard Time, UTC+00:00)  #  Comments [0] 

# Wednesday, January 28, 2004
Unit Testing

There is a fantastic article on the subject linked to from this item by Justin Gehtland. I really like how the Justin equates unit testing to the spell checker in Word. You shouldn't have to wait until you are done with the document or, worse, wait until the client calls you to know that you misspelled something.


Development
Wednesday, January 28, 2004 11:13:42 PM (GMT Standard Time, UTC+00:00)  #  Comments [1] 

# Monday, January 26, 2004
Speaking at DevDays
I'll be speaking at DevDays Detroit - March 3, 2004

Speaking
Monday, January 26, 2004 5:13:49 PM (GMT Standard Time, UTC+00:00)  #  Comments [0] 

# Saturday, January 24, 2004
RSS Winterfest

I "Attended" most of the RSS Winterfest and it was an interesting experience on many levels.

First, some thoughts about the content itself. It was interesting to hear some of the uses of RSS. I personally think that it would be more interesting to have heard more about the technical implementations of some of the uses of RSS rather than chatter about how cool it is and how well it was being adapted. By virtue of attending the conference, we were by definition the proverbial choir that was being preached to. As a result, I thought that most of this was wasted. Bill French of MyST gave one of the more interesting talks because he talked about actual uses of RSS and how it helped solve problems outside of the realm of blogging and news syndication. In that same vein was Greg Lloyd of Traction Software who talked about using RSS to fight drug gangs in San Diego. This is not obvious at first, but if you start thinking about getting the right knowledge out into the hands of everyone who needs it about the latest gang intelligence so that they can more work efficiently – RSS is the obvious answer.

Some of the things that were interesting were the discussions on how to make the business case for RSS and the discussion about advertising. The short version is that since most of the RSS feeds are for free and businesses want to make money off of them, they don’t see the value of them. As a result of this, some of people are looking at the value of advertising in the feeds as a way of generating revenue.

Second, I want to talk about the virtual conference experience itself. On the whole it was a decent experience. I got to sit in the comfort of my home and listen to the whole thing with my own coffee (rather than the cheap junk that they usually try to pass off as coffee), my own food (same as the coffee) and so on. That part of it was really nice.

However, there were a couple of things that I found less than appealing… No, I’m not talking about the lack of swag on the exhibitor floor because I speak at enough conferences that I’m sick of the cheap t-shirts and pens that were bought at $10.00 a thousand. Mainly, I missed the personal contact with the speakers and other attendees. Yes, there was the Wiki and so on, but I could really get to know anyone or corner a speaker after a talk for half an hour to really get to know him and ask him about the talk. From a speakers stand point, it would be hard to get a read on the crowd to know if you’ve lost them or not. I mean, how do you know that the Wiki is not just 10 people that are interested and the other 1000 people are tuning out because you’ve lost them.

The last point on the conference itself is that I was rather unimpressed by the pushing of the powerpoint and so on. It would have been much more engaging, I think, to have a more traditional web cast type of setup where the audience could see the speakers. At a minimum, it would have been nice to have photos of the speakers on the page so that we could see who they were and put names/voices with faces.

I’m really interested in comments on the virtual conference idea here as I’m always looking for good ways to reach people. I’m just wondering if the virtual conference is the right media.


RSS
Saturday, January 24, 2004 6:00:47 AM (GMT Standard Time, UTC+00:00)  #  Comments [0] 

# Monday, January 01, 2001
About Me

Josh Holmes I've been speaking at a lot of different events recently and I keep having to put together a bio. Some events want short bios, some want long bios. To help me more than anything else, I thought I'd post a couple of different lengths of bios out here so that I had a nice easy to point people to collection.

Micro Bio
Josh Holmes is a RIA Architect Evangelist for Microsoft.

Short Bio
Josh Holmes is a RIA Architect Evangelist with Microsoft focused on building and educating the dev partners with a Rich Internet Application offering in Central Region. Prior to joining Microsoft in October 2006, Josh was a consultant working with a variety of clients ranging from large Fortune 500 firms to smaller sized companies. Josh is a frequent speaker and lead panelist at national and international software development conferences focusing on emerging technologies, software design and development with an emphasis on mobility and RIA (Rich Internet Applications). Community focused, Josh has founded and/or run many technology organizations from the Great Lakes Area .NET Users Group to the Ann Arbor Computer Society and was on the forming committee for CodeMash. You can contact Josh through his blog at http://www.joshholmes.com.

Josh Holmes on Mount Crested Butte - photo by James WardLonger and more self serving Bio
Josh Holmes is a RIA Architect Evangelist with Microsoft focused on building and educating the dev partners with a Rich Internet Application offering in Central Region. Prior to joining Microsoft in October 2006, Josh was a consultant with SRT Solutions working with a variety of clients ranging from large Fortune 500 firms to smaller sized companies. In most situations, Josh was called in as the technical leader on a project to lead the clients team to success. Josh is a frequent speaker and lead panelist at national and international software development conferences, including VSLive, Software Development Expo (East and West), Basta and the Rich Web Experience,  focusing on emerging technologies, software design and development with an emphasis on mobility and RIA (Rich Internet Applications). Josh has written and delivered many training classes over time for both public audiences as  well as courses tightly tailored for the clients needs. The topics of these classes ranged from XML to ASP.NET to the Compact Framework. Josh speaks from his experience and conviction based on many production successes that his clients have experienced. Community focused, Josh has founded and/or run many technology organizations from the Great Lakes Area .NET Users Group to the Ann Arbor Computer Society and was on the forming committee for CodeMash. You can contact Josh through his blog at http://www.joshholmes.com.

You can contact me at josh.holmes@microsoft.com.

Josh Holmes



Monday, January 01, 2001 6:00:00 PM (GMT Standard Time, UTC+00:00)  #  Comments [0]