473,840 Members | 1,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MVC-Pattern in my C# GUI !?!

Hi NG !
For learning work with patterns I would like to add the MVC-Pattern in my
little application.
On my form (View) I have a TabController with 2 tabs. In each tab I would
like to have a datagrid, which should be updated after some changes. So this
two datagrids must implement my observer-interface. My class supportControl
would be the Model, which extends from my observable class.
Thats my theoretical understanding.. .now my questions to the implementation
in C#:

1.) The 2 Datagrids are the objects, which must be updated. Do I have to
create two classes (for each datagris one), which extends from
System.Windows. Forms.DataGrid and implements my observer interface ?
2.) My DataGrid on the main form would initialized by the classes i created
under point 1.) ???

Sorry this questions, but I'm not sure, if thats the right way of
implementation MVC !

Thanks and regards

Marcel Hug
Jan 2 '06
10 5987

Finally a useful reply.

Thank you Jeorg

On Mon, 02 Jan 2006 11:18:55 -0800, Joerg Jooss
<ne********@joe rgjooss.de> wrote:
Hello Marcel,
Hi NG !
For learning work with patterns I would like to add the MVC-Pattern in
little application.
On my form (View) I have a TabController with 2 tabs. In each tab I
like to have a datagrid, which should be updated after some changes.
So this
two datagrids must implement my observer-interface. My class
would be the Model, which extends from my observable class.

Actually, you need neither an observer interface (C# is not Java -- use events),
nor should your model need to extend from any particular class. Your controller
should update the model, the model should expose events to signal state changes,
and your views should subscribe to those model events they care about. See
http://www.codeproject.com/csharp/mo...controller.asp for an introduction.


Jan 5 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: pysim | last post by:
Hi, I have a couple of general requests for pointers to python examples and design advice. I'm looking for examples of MVC-based GUI controls done in python (model-view-controller). Also, examples where something like a simulation model running in its own thread sends fast updates to a GUI in near real-time. The only examples I've seen, such as SimPy, wait until the model is finished running before outputting data.
by: | last post by:
Hi all, Like to know if any one have implementated any enterprise .Net Solution using MVC Model? Is there any doc (whitepaper) or write up on this? Thanks. regard
by: avlee | last post by:
Hello I am planning in my company to move to php.MVC framework - to create several big web applications. What are your opinions of this framework ? Is it the best MVC framework for PHP ? What are the pros and cons ? Best regards, Michal
by: scott.w.white | last post by:
Looking at different MVC frameworks from many langauges from PHP to Python, I've concluded that the explosion of MVC frameworks is mainly due to undisciplined & unexperienced programmers. Nobody would argue about the separation of the layers because this is not the problem I have with it, if anything most implementations emphasis separation at the wrong places. The end solutions end up looking very mickey mouse. It's been long...
by: Sean Quinn | last post by:
Hi all, This may have a really simple answer to it, but I can't seem to figure it out no matter how much I think about the problem. I'm working with an MVC framework (presently the most recent version of the Zend Framework 0.93, but no too committed with the project to prevent me from switching gears to a different framework), but I am having one heck of a time when attempting to reference static resources such as javascript scripts,...
by: -pb- | last post by:
We are developing a Windows client using .NET 2.0 and C#. We have decided to use MVC based architechture due to its obvious advantages. This application shows data from database in a Grid. We want to add a functionality of Printing grid and export grid to XL sheet. I would like to know where will I have to code above functionalities? Should it be in view or controller? Any suggestion is well come.
by: Richard Coltrane | last post by:
Hello, Can anyone point me in the direction of some good introductory resources to MVC and Web. I have looked up several resources on MVC in general (none of which have any code samples) but I dont get hw it applies to web. In a winforms app i can see how MVC plays out. I have 2(n) different views, something changes in one of them, so we fire off a message to notify the other to update. The makes senseto me because their both...
by: shapper | last post by:
Hi, I was checking the new ASP.NET MVC Preview 4 features and I found the following: var dataTokens = new RouteValueDictionary(); dataTokens.Add("namespaces", new HashSet<string>( new string { "MyApp.Blog.Controllers", "MyApp.Forum.Controllers",
by: Author | last post by:
I happened to see this asp.net MVC tutorial at http://www.asp.net/learn/mvc/tutorial-01-cs.aspx Indeed as the author says it is gonna look like classic ASP at the very beginning of this tutorial. I think form post with an action (which is classic asp style) like <form method="post" action="/Home/CreateNew">
by: Airslash | last post by:
Hello, this is my second article that I'm writing for bytes.com, and this time I wish to share some knowledge on how to test a custom ActionFilterAttribute for a controller in the ASP.NET MVC 2 Framework. I've been working with the Framework for a month now, comming from a Ruby on Rails background, and developed a special ActionFilter that performs authentication of users against our database using customized HTTP headers. The concept...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.