By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,575 Members | 1,853 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,575 IT Pros & Developers. It's quick & easy.

Formatting Text Boxes with Data Relations

P: n/a
I need to format the data in some textboxes using the
Binding method with custom Currency and ShortDate format
and parse handlers.

Here is the code that I am using. I call it on the form
load event:
Private Sub setTextBoxDataBindings()

'set default value for Boolean data fields

Me.objdsContractMgmt.tblContract.PortfolioPlusColu mn.Defau
ltValue = False

Dim b1 As New Binding("text",
objdsContractMgmt, "tblContract.ContractEffectiveDate")
AddHandler b1.Format, AddressOf FormatShortDate
AddHandler b1.Parse, AddressOf ParseShortDate
Dim b2 As New Binding("text",
objdsContractMgmt, "tblContract.ContractExpirationDate")
AddHandler b2.Format, AddressOf FormatShortDate
AddHandler b2.Parse, AddressOf ParseShortDate
Dim b3 As New Binding("text",
objdsContractMgmt, "tblContract.LOCDate")
AddHandler b3.Format, AddressOf FormatShortDate
AddHandler b3.Parse, AddressOf ParseShortDate
Dim b4 As New Binding("text",
objdsContractMgmt, "tblContract.PriceProtectionDate")
AddHandler b4.Format, AddressOf FormatShortDate
AddHandler b4.Parse, AddressOf ParseShortDate
Dim b5 As New Binding("text",
objdsContractMgmt, "tblContract.DateAssigned")
AddHandler b5.Format, AddressOf FormatShortDate
AddHandler b5.Parse, AddressOf ParseShortDate
Dim b6 As New Binding("text",
objdsContractMgmt, "tblContract.rlnContractItems.OriginalS
pend")
AddHandler b6.Format, AddressOf FormatCurrency
AddHandler b6.Parse, AddressOf ParseCurrency
Me.editEffectiveDate.DataBindings.Add(b1)
Me.editExpirationDate.DataBindings.Add(b2)
Me.editLOCSignedDate.DataBindings.Add(b3)
Me.EditProtectedDate.DataBindings.Add(b4)
Me.editAssignedDate.DataBindings.Add(b5)

Me.editItemOriginalSpend.DataBindings.Add(b6)

End Sub

I have successfully done this for the top table in my
dataset. My dataset has 4 levels of relations. (1-M-M-M)

The code above shows the bindings that I create for each
text box or label needing special formatting. The first 5
work great. But when I introduced the 6th one, I get this
error when loading the dataset:

"Failed to enable constraints. One or more rows contain
values violating non-null, unique or foreign-key
constraints"

This field is in the child table to the top parent table.
I cannot find any examples of creating bindings like this
using relations and child tables. If I bind the text box
directly (in the UI Designer properties window) with no
special formatting, everything works fine, although the
data looks bad.

What am I doing wrong? Any help is always appreciated!

Thanks is advance...
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hello,

"msmcg" <ms*******@ameritech.net> schrieb:
I need to format the data in some textboxes using the
Binding method with custom Currency and ShortDate
format and parse handlers.


You will more likely get an answer to your question if you post the question
in this group:

news://news.microsoft.com/microsoft....ms.databinding

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.