Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Interfaces to represent winforms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
parez - 05 Mar 2008 15:59 GMT
I am planning to make my winforms implement an interface representing
the data on the forms.
And the interface will be passed to a class which will contain the
data to be populated on the winforms.I am planning to use reflection
to the populate the winforms.
The reason why i am doing it is to keep the separate the data classes
and UI.
In future I mite have to develop an asp.net Application.(all i will
have to do is create webforms which implemtn the interface).

Please comment. ANd TIA

An example of the class which contains data for the AddressForm is
below.

public class AddressRequest
   {

       public Address()
       {
       }

       [FormMapper("StreetAddress")]
       public string StreetAddress { get; set; }

       [FormMapper("Address2")]
       public string UnitNumber { get; set; }

       [FormMapper("City")]
       public string City { get; set; }

       [FormMapper("State")]
       public string State { get; set; }

       [FormMapper("Zip")]
       public string zip { get; set; }

   }

public interface IAddresss

{
 string StreetAddress;
 string Address2;
 string city;
string state;
strring zip;
string country;
}
Andy - 05 Mar 2008 16:13 GMT
>  I am planning to make my winforms implement an interface representing
> the data on the forms.
[quoted text clipped - 46 lines]
>
> }

Why not just use a bindingsource?
parez - 05 Mar 2008 16:50 GMT
> >  I am planning to make my winforms implement an interface representing
> > the data on the forms.
[quoted text clipped - 48 lines]
>
> Why not just use a bindingsource?

I havent used much of bindingsource before. Is the thing going to work
in asp.net forms?
And I like having control wherever I can.(I know that is not a good
selling point)
Andy - 05 Mar 2008 17:43 GMT
> > >  I am planning to make my winforms implement an interface representing
> > > the data on the forms.
[quoted text clipped - 53 lines]
> And I like having control wherever I can.(I know that is not a good
> selling point)

BindingSource is a Windows forms component.  I think there may be a
similar control in Asp.Net though.

You can have control, but the problem is you're re-inventing the
wheel.  And your code won't be portable to say WPF.
parez - 06 Mar 2008 21:26 GMT
> > > >  I am planning to make my winforms implement an interface representing
> > > > the data on the forms.
[quoted text clipped - 59 lines]
> You can have control, but the problem is you're re-inventing the
> wheel.  And your code won't be portable to say WPF.

Hi

I am not longer using the Attributes..   The addressForm class and the
Address class (just an exmpale)  will both implement IAddress. I will
use reflection to populate the interface that is passed to my address
class. winform or webform .
Why do you say code will not work in WPF? I mean the code with
attributes. I have not used WPF.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.