473,406 Members | 2,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Formatting Text Boxes with Data Relations

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
1 3874
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John Kreps | last post by:
(acc 2002) I've got six unbound text boxes on a subform that has a white background. Each of those six boxes has an expression that when true, will change its background from white to another...
1
by: CSDunn | last post by:
Hello, I have about 200 text boxes on an Access 2000 Report that need to have a black background if the data in the text box is 'X'. Is there a way I could create one procedure that might work...
2
by: Mitchell Vincent | last post by:
I have a bunch of text boxes and labels that hold currency values. I need some formatting on them, but since they are databound to a set, I'm confused as to how to do that. Do labels and text boxes...
12
by: dmieluk | last post by:
Problem: When moving between records, I need to control which combo/text boxes are displayed on the current form, dependent upon data in the current record. More: I building my first...
1
by: AmitKu | last post by:
I've got the Gridview going at full speed, and I've enabled editing, but when I click on the "edit" button, this ugly editing UI comes up. Well it's not ugly, but it's not great either. How do I...
4
by: Peter Newman | last post by:
the data input app im writing has some 30 + input fields and i want to be able to format them. I know i can use the .validate on each textbox and format the 'string' however this require loads...
2
by: Peter Newman | last post by:
Firstly i would like to tank the helpful posts in the past regarding formatting... the scenario is that i ahve a form created by the data wizard. I have created a private sub to handle the...
2
by: penaloj | last post by:
I am assembling a database of scientific names, e.g. Acer saccharum Marshall, sugar maple. The first two elements (genus and species) should be italicized in the report, the third element (author)...
10
by: sara | last post by:
Hi - I have a report that is 14 columnar sub-reports (Line up: Position- holders in each of our 14 locations - Manager, Assistant Manager, Receiving, Office, etc). I output directly to PDF...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
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...
0
jinu1996
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...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

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.