473,396 Members | 1,998 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,396 software developers and data experts.

Formatting Databound Control Disabling CurrencyManager.methods

Hello...

I am creating a CurrencyManager object and setting it like this ...
Code:
Dim cm as CurrencyManager
(...)
'On Open event of form
cm = Me.BindingContext(ds,"tblPersonData")
I am databinding all of my Textbox controls to various fields in
tblPersonData. Everything is working fine using cm.methods (such as
cm.Position = cm.Position+1) until I attempt to format one of my
databind controls.

I have a field in the tblPersonData table that contains a date
(tblPersonData.TermDate). I do not wish to display the time portion of
the date ... so I attempted to format the binding as follows ....

Dim obTermDate as Binding = New
Binding("Text",ds,"tbPersonData.TermDate")
AddHandler obTermDate.Format, AddressOf obTermDate_Format
Me.tbTermDate.DataBindings.Add(obTermDate)
Private Sub obTermDate_Format(ByVal sender as Object, e as
System.Windows.Forms.ConvertEventArgs)
e.Value = Format(e.Value, "MM/dd/yyyy")
End Sub
If I comment out the line

e.Value = Format(e.Value, "MM/dd/yyyy")
The methods of the CurrencyManager object (cm) work fine. When that
line is not commented, the first record of tblPersonData is displayed
with the term date in the correct format. However, the CM.methods are
not working. For example, cm.Position = cm.Position +1 doesnt move to
the next record as it did with that line commented out.

No exception is thrown, and while debugging the code, I see it execute
the CM.methods and move on.

Anyone have any idea on why CM would become disabled when applying a
format to e.Value?
Thanks,
Johnny

Nov 21 '05 #1
1 1535
Johnny

Did you try this in your format event (watch typos)
\\\
If cevent.Value Is DBNull.Value Then
cevent.Value = ""
Else
cevent.Value = CDate(cevent.Value).ToString("d")
End if
///
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Billy Jacobs | last post by:
I have created a DataGridColumnDatePicker Component so that I can put a datetimepicker control in my datagrid. It almost works. When I put my mouse in the cell it changes to a datetimepicker...
1
by: Patrick Demets | last post by:
I have a fairly simple form with databound text boxes, but changes (or new records) are not recognized. The text boxes are successfully populated with data (from the database) and I can cycle...
2
by: David K. | last post by:
My question concerns C# Windows Forms user controls. I have created navigation user control. It gets the parent control's CurrencyManager to its bindable property. In the control, any change in...
3
by: David K. | last post by:
My question concerns C# Windows Forms user controls. I have created navigation user control. It gets the consumer application parent control's (a Form) CurrencyManager to its bindable property. In...
0
by: John Smith | last post by:
Hello all: Another day another problem :). How do you synch a databound combobox with the rest of the controls that are on a form. I have a combobox that lists a bunch of names and upon...
14
by: Rowland Shaw | last post by:
I've got a databound combo (databound to a System.Data.DataTable), but some rather unpredicatable behaviour -- even though I have 8 rows in the source table, only the first 6 are showing up in the...
5
by: clickon | last post by:
This is driving me nuts, it is such a simply thing to do but i cannot for the life of me work out how you are suposed to do it. I want to update the data in DropDownListB based on what is...
1
by: Owen Blacker | last post by:
I've spent loads of time Googling to try to work this one out and I'm sure it's something obvious. I get an InvalidOperationException reading "Databinding methods such as Eval(), XPath(), and...
6
by: Tomasz J | last post by:
Hello developers, I bind my TextBox control specyfying a format stored in my application global ApplicationContext object - it has a static string CurrencyFormat property. The problem - this...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.