473,401 Members | 2,127 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,401 software developers and data experts.

Updating a databound textbox via its bound field.

So here's the situation (.NET 2.0 btw):
I have a form, and on this form is a textbox among many other
databound controls. The textbox is bound to a field in a data table
via the Text property. In this table there are multiple columns that
cannot be NULL, which, are bound to other controls (but they're not
really important at this time).

I create a new row via the currency manager like so:
_currencyManager.AddNew()
_currentRow = CType(_currencyManager.Current, DataRowView).Row

I have code in the OnLoad event that modifies the bound field
programmatically:
protected overrides sub MyForm_OnLoad(blah blah blah)
if (newRecord) then
_currentRow("TheTextBoxField") = "SOME VALUE!"
end if
end sub

The other controls/fields are blank (and they're supposed to be
empty), even if their fields require data (I do validation for this
later on).

I've read that updating the backing field is the correct way to update
a bound control because the control relies on validation to commit its
value to the field (I know you can change the binding update event to
OnPropertyChanged or what have you, but let's leave it at the default
and use validation). I assume this is the correct procedure when
updating bound data programmatically?

The problem:
Now. The issue is that when I update the backing field the textbox
does NOT get updated. It's blank. I know for sure the data is there
because in the Immediate window _currentRow("TheTextBoxField") returns
"SOME VALUE!". Shouldn't this update the textbox Text field
automatically (seeing as it's bound to that property, yes, I've double
checked)? Would having controls with empty (NULL) values bound to non-
NULL fields cause an issue with this? Would calling it in the OnLoad
event cause any problems with this?
Jun 27 '08 #1
0 2466

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

Similar topics

2
by: Megan | last post by:
Hi everybody- I have 2 tables, Hearings and Rulings. Both have primary keys called, CaseID, that are autonumbers. I don't want both tables to have the same autonumber. For example, if Hearings...
4
by: John Rose | last post by:
I have one databound TextBox on a page with one button. The TextBox loads the correct SQL record data but typing a new string into the Textbox fails to change the DataSet. Any ideas? There must...
1
by: shapper | last post by:
Hello, How can I make a GridView Bond Field to display its text in Bold? I couldn't find any CssClass or Bold property in the Bound Field. Thanks, Miguel
4
by: Peted | last post by:
Hello i have a textbox on a form1. I want to pass the name of that textbox as a paramter to another class (not a form class) and once gotten this paramter i want to update the textbox on...
2
by: BD | last post by:
Hi, How can I get the name of the bound field from a control that has binding to a BindingSource at runtime. For example: txtID.DataBindings.Add("Text", bdgSourceTest, "ID"); txtID is a...
9
by: Kyote | last post by:
I have a textbox that is databound to a table in an access database. The field only contains month/day/year but my databound textbox is also showing a time. Is there any way to prevent it from...
3
by: kathnicole | last post by:
Hi, I am using MS Access 2007/Vista I have a field, ProductCost in the subform. i need to find the total of ProductCost and assign it to a field, Total, in the Main Form . I read an article...
1
by: JFKJr | last post by:
Hello everyone, this one might be simple but driving me crazy! Your help will be greatly appreciated. Basically, I created a textbox bound to "Date" field in an Access VBA form. But when the...
1
by: bkberg05 | last post by:
Hi - I have a form called 'Order'. It has a subform called 'Order_Detail'. On the 'Order_Detail', I have many records for each order record. On the footer of the subform (it's a continuous...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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?
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
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...

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.