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 / Windows Forms / WinForm Data Binding / April 2007

Tip: Looking for answers? Try searching our database.

Databinding custom class to a user control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RickD - 03 Apr 2007 21:50 GMT
OK, I expect this is a noob data binding question but after days searching
the msdn forums, google and my form books for an answer, I hope someone here
can explain to me what I’m doing wrong.

I have a custom class called Location, which has Latitude and Longitude
properties.  These values are saved in double radians.  I’ve created a user
control which displays the lat/lon in several formats (decimal degrees,
degrees/minutes/seconds, UTM).  None of these formats reflect the underlying
data type of Location.  In the user control I have a text box which displays
the value and a combo box to pick the units.  Following the pattern I saw in
DateTimePicker I made a property of the control called Value which is the
Location associated with the control.  You use the get of Value to retrieve
the value and set will initialize the text box via code.  This all works
great but I cannot bind a Location object to the Value property of the user
control.

So, question 1, what steps do I have to follow to make a data bound user
control which binds to a custom class.

What makes this problem more interesting is that I want to embed the control
as a column in a datagrid.  I have the cell and column and Editing control
all working.  But after I enter a value in the editing control, the Location
is not being pushed back to the data grid.  I suspect this is due to the
problem I’ve listed above.
Bryan Phillips - 05 Apr 2007 02:25 GMT
Try reproducing the problem by added the user control to a form.  If the
problem still occurs, it is a binding problem.  Otherwise, the
DataGridView could be the problem.

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog:  http://bphillips76.spaces.live.com
Web Site:  http://www.composablesystems.net

> OK, I expect this is a noob data binding question but after days searching
> the msdn forums, google and my form books for an answer, I hope someone here
[quoted text clipped - 20 lines]
> is not being pushed back to the data grid.  I suspect this is due to the
> problem I've listed above.

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.