bindingcontext

E

Edwin

Hi,

I created a dataform with the data form wizard which
created some textboxes and 1 checkbox. When I add a row
(see section "Add Row" for code) the newly added is not
accessible.

A label "lblNavLocation" generated by the wizard shows
that a row has been added but I can not navigate to it.
See section "PositionChanged" for code.

The form works fine without the checkbox.

Any ideas on what is happening? Could you explain it to
me?

Thanks,

Edwin


Add Row:
/////////////////////////////////////////////
Me.BindingContext
(objFormDS, "PreventiveTasks").EndCurrentEdit()
Me.BindingContext
(objFormDS, "PreventiveTasks").AddNew()
On the form there is a check box.
/////////////////////////////////////////////

PositionChanged:
//////////////////////////////////////////////
Me.lblNavLocation.Text = (((Me.BindingContext
(objFormDS, "PreventiveTasks").Position + 1).ToString + "
of ") _
+ Me.BindingContext
(objFormDS, "PreventiveTasks").Count.ToString)

//////////////////////////////////////////////
 
S

Steven Stein [MSFT]

Edwin,
This is usually the result of controls not being able to display Null
values.

Check out the Binding.Format and Binding.Parse Events. If you convert the
Nulls into values the controls can render, the problem should go away. (For
example, change the Null value to a string like "<Null>" or "Null" in the
Binding.Format method that can be isplayed in the TextBoxes created by the
wizard.)


Binding.Format Event
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformsbi
ndingclassformattopic.asp

Binding.Parse Event
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWindowsFormsBi
ndingClassParseTopic.asp




Hope that helps,
Steve
VB.Net team
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top