Welcome

You have reached the blog of Keith Elder. Thank you for visiting! Feel free to click the twitter icon to the right and follow me on twitter.

CodeMash – See you there!

Posted by Keith Elder | Posted in .Net, Smart Clients, Speaking | Posted on 21-12-2006

0

If you are a developer you need to hurry up and get registered for CodeMash in January. What better way to spend a few winter days than at an indoor resort listening to geeks speak about PHP, Python, Java, Ruby and .Net? It is right around the corner and for this type of conference, it is pretty dang cheap. I will be speaking at the conference on Smart Clients so don’t forget your box of rotten fruit and fire away when I take the stage. Hope to see you there!

Speaking at CodeMash!

Posted by Keith Elder | Posted in .Net, Presentations, Smart Clients | Posted on 27-11-2006

0

I found out the other day that I will be speaking at CodeMash in Ohio during the warm month of January.  What am I speaking on?  I’ll give you one guess.  You guessed it, Smart Clients, ClickOnce, Web Services, SOA, etc.  It is a small world sometimes too.  The email about me speaking came from Jason Gilmore who I met while at Microsoft this past September during an ASP.Net Summit.  Jason and I talked about Media Center and tons of other stuff.  Who knew!  He was also on the bus when we got struck by some crazy chic.

 

The resort the conference is at is going to be really cool.  Not to mention the entire event is put on by the community and covers tons of technologies.  From a .Net presenter perspective these are usually tougher venues to speak at because you aren’t speaking in front of a bunch of people that swallowed the blue pill.  For me though, I don’t think that will be a problem since I can talk Linux, OS X, PHP and open source with the best of them. 

If you haven’t gotten signed up, what are you waiting for!!!!!!!!!

Tip: CheckedListBox and ComboBox Programmatic Binding

Posted by Keith Elder | Posted in .Net, Smart Clients | Posted on 03-11-2006

0

At some point in your career as a software engineer you are going to run across the need to build your forms dynamically.  Whether you read information from a database, dataset, or xml file.  Recently I was working on a new feature for our internal Smart Client application whereby we can add new fields into the database for our application and have the new field show up in the appropriate screen and auto validate itself.  The feature itself when complete is going to be very cool and allow us to add new form fields at will without having to get a database engineer or anyone involved. 

 

The Problem

I ran across a problem this week that stumped me for a bit while trying to generate CheckedListBox and ComboBox controls on my UserControl.  Here is a pseudo example of the code for educational purposes:

 

    1  public partial class Form1 : Form

    2     {

    3         SubtextDataDataSet _dsBlog = new SubtextDataDataSet();

    4 

    5         public Form1()

    6         {

    7             InitializeComponent();

    8             // get data

    9             SubtextDataDataSetTableAdapters.subtext_ContentTableAdapter ta = new WindowsApplication1.SubtextDataDataSetTableAdapters.subtext_ContentTableAdapter();

   10             _dsBlog.Merge(ta.GetData());

   11         }

   12 

   13         private void Form1_Load(object sender, EventArgs e)

   14         {

   15             CheckedListBox chkListBox = new CheckedListBox();

   16             chkListBox.Name = “BlogEntries”;

   17             chkListBox.Sorted = true;

   18             chkListBox.DataSource = _dsBlog.subtext_Content;

   19             chkListBox.DisplayMember = “Title”;

   20             chkListBox.ValueMember = “ID”;

   21             chkListBox.Location = new Point(12, 12);

   22             chkListBox.Size = new Size(289, 219);

   23             chkListBox.CheckOnClick = true;

   24 

   25             for (int i = 0; i < chkListBox.Items.Count; i++)

   26             {

   27                 if (i % 2 == 0)

   28                 {

   29                     chkListBox.SetItemCheckState(i, CheckState.Checked);

   30                 }

   31             }

   32             this.Controls.Add(chkListBox);

   33         }

   34     }

 In the above example we have a DataSet that we are reading in the posts to our blog.  I’ve been playing with SubText lately so I decided to use this.   Lines 15-23 are fairly simple whereby we create the control and then bind our DataSource to our control.  Lines 25-31 is where the problem is.  Even though we’ve bound our control to our DataSet, there is nothing in the chkListBox.Items collections.  If we run this code, here is what we’ll see:

Form1

What you notice right away is every other item is not checked (although you think they would be).  Even though our data is getting bound to our control the DataSource we’ve declared does not get moved into the Items collection of the control until it gets rendered. 

The Solution

After struggling with this for awhile the solution to this problem is a one liner.  Most solutions are 🙂  The answer is instantiate the BindingContext of the control.  After the data is bound to the control the following needs to be called:

 

chkListBox.BindingContext = new BindingContext();

After adding this line into our code and rebuilding the solution we can see we get the results we originally wanted.  

Form2

For those that run into this issue I hope this post helps you.  I know that I searched every known search engine known to man kind and didn’t find a clear example nor explanation how to fix the problem.   I also should note that even though the DataSource, DisplayMember and ValueMember properties do not show up in intellisense in Visual Studio, they are in fact there!  Happy Coding. – The Elder

Alabama Code Camp Download Available

Posted by Keith Elder | Posted in .Net, Presentations, Smart Clients | Posted on 30-10-2006

0

Saturday was the Alabama Code Camp in Montgomery.  I didn’t get to blog about it too much since I spent most of my energy either updating my demos or driving (5 hour drive).  I finally got to meet Doug (the new DE for the area) as well as chat with a few of the other speakers (Bruce Thomas, Todd Miranda, Mark Dunn, Jeremy Chance (thanks for the ride!), Jim Wooley and William Howell),  at the speaker get together on Friday.   The turn out was really good, rumors are floating around 150 or so attended. 

It was also good to see some familiar faces from the Mobile User’s Group.  Several of them finally got to here the enterprise architecture session since we had to cut it short when I visited.

You can find all the material of the two sessions I did at http://keithelder.net/Presentations/DevelopingSmartClientAppsForEnterprise/Default.aspx.  This track will continue to grow and be updated as I add more material so stay tuned for updates.

Alabama Code Camp

Posted by Keith Elder | Posted in .Net, Presentations, Smart Clients | Posted on 13-09-2006

0

Saturday October 28th is the Alabama Code Camp in Montgomery, AL.  Some great speakers are getting lined up and although I had to pay Joe Healy a large amount of money to speak at the event, he finally let me in 🙂 I will be doing two sessions on Smart Clients.  One is an intro to Smart Clients and new features of Visual Studio.  The second one I’m doing is all about the Enterprise Architecture of Smart Clients.   Others are covering Atlas, Mobile 5 applications, ADO.Net 2.0 and lots more.  Should be a great code camp!