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 / October 2004

Tip: Looking for answers? Try searching our database.

Problem binding TextBox to array of DataRows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Amey - 28 Oct 2004 15:31 GMT
Hi all

I am getting the following error when binding some TextBoxes to an array of
DataRows:

Property accessor 'AddressLine3' on object 'dsMyDataSet+AddressRow' threw
the following exception:'Cannot get value because it is DBNull.'

I have been binding to DataTables until now, but I do need the ability to
bind to arrays of DataRows. Does anyone know how to get around this problem
and still be able to bind to DataRows?

Here is the code:
------------------------
Public Sub SetDataBinding(ByVal rows() As dsCABS.AddressRow)
  ' The Properties of the control adsAddress are just references to the
TextBoxes
   Me.grdList.SetDataBinding(rows, "")
   Me.adsAddress.AddressLine1.DataBindings.Add("Text", rows,
"AddressLine1")
   Me.adsAddress.AddressLine2.DataBindings.Add("Text", rows,
"AddressLine2")
   Me.adsAddress.AddressLine3.DataBindings.Add("Text", rows,
"AddressLine3")
   Me.adsAddress.Locality.DataBindings.Add("Text", rows, "Locality")
   Me.adsAddress.Town.DataBindings.Add("Text", rows, "Town")
   Me.adsAddress.County.DataBindings.Add("Text", rows, "County")
   Me.adsAddress.Country.DataBindings.Add("Text", rows, "Country")
   Me.adsAddress.PostCode.DataBindings.Add("Text", rows, "PostCode")
End Sub
------------------------
Kind Regards,
Steve.
Steve Amey - 28 Oct 2004 15:51 GMT
Hi all

No worries, have found the answer.

HOW TO: Make a Typed DataSet Return a Default Value Instead of DBNull by
Using Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;318039

Regards,
Steve.

> Hi all
>
[quoted text clipped - 29 lines]
> Kind Regards,
> Steve.

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.