If not CAB, then what?

  • Thread starter Thread starter Ronald S. Cook
  • Start date Start date
R

Ronald S. Cook

I want to design/develop a Win app with an Outlook-like feel. That is, lots
of different modules. If I don't go with Composite UI Application Block
(CAB) design, how else could I do it? In other words, what could allow for
"master/parent" functions without having to duplicate them to every single
form?

I've used user controls (instead of forms) for various "modules" and insert
them onto a master form, but is this my only other alternative?

Thanks,
Ron
 
You have to look into the MVC (Model View Controller) pattern.

Basically.

Somewhere, there exists a "model". A model is usually some data.

You build views .... which will work with the model.

The controller acts as in in-between.

-- that's a quick, wayyyyy to little explanation. As in, don't expect to
learn MVC from reading 6 lines of a newsgroup post.

However, here is a winforms tip:
Then.. (in a winforms app), you can do some some bindings.


Binding titleIdBinding = txtTitleId.DataBindings.Add("Text", this.m_model,
"TitleId");
//this is another "hint" .. after you get past the initial learning
curve//titleIdBinding.Format += /* might be wrong, please check */ new
EventHandler(BindingNullCheck);

this.txtTitle.DataBindings.Add(new Binding("Text", this.m_model, "Title"));


this.txtType.DataBindings.Add(new Binding("Text", this.m_model,
"TitleType"));
this.dtpPubDate.DataBindings.Add(new Binding("Value", this.m_model,
"PublishedDate"));
this.txtPubDate.DataBindings.Add(new Binding("Text", this.m_model,
"PublishedDate"));

// a child sub object
this.txtPubId.DataBindings.Add(new Binding("Text", this.m_model,
"CurrentPublisher.PublisherId"));
this.txtPublisher.DataBindings.Add(new Binding("Text", this.m_model,
"CurrentPublisher.PublisherName"));



here, my "model" is a class
(abbreviated represenation, all the items are properties)
class Title
public string TitleId
public string Title
public string TitleType
public DateTime PublishedDate
public Publisher CurrentPublisher // child object

class Publisher
string PublisherId
string PublisherName


................
..Net 2.0 has some improvement handling NULL values. Which is important when
you're adding a new item.. and don't have a populated model .


'Improved in .NET 2.0 //
http://msdn2.microsoft.com/library/y0h25we8(en-us,vs.80).aspx
'titleIdBinding.NullValue = "Type a TitleID Here";


Good luck....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top