I am having trouble with the binding of a check box. I have a form for
editing and adding reps. I am using a bindingsource and a bindingnavigator.
I have on the form an "Active" checkbox, which is bound to the IsActive field
in the bound data table. It works fine for the reps that are already in the
table. The problem occurs when I click on the AddNew button on the
bindingnavigator. I have the field in the table to default to true, because
when I add a rep, he will be active. The checkbox is checked when the AddNew
is clicked, but that data is never written back to my underlying data.
Everything else is written, but the IsActive field is false, despite what is
in the check box. How can I get the new rep to have the IsActive field set
to true? 6 4738
Vernon,
What type of the DataSource? Dataset or customer object: Have you checked the underlying data after
it is created to make sure Active is set true?
How do you know it's the binding and not the routine to write it back? Have you checked the
underlying data just before it is written back to the DB?
Flomo
--
Vernon Peppers wrote:
I am having trouble with the binding of a check box. I have a form for
editing and adding reps. I am using a bindingsource and a bindingnavigator.
I have on the form an "Active" checkbox, which is bound to the IsActive field
in the bound data table. It works fine for the reps that are already in the
table. The problem occurs when I click on the AddNew button on the
bindingnavigator. I have the field in the table to default to true, because
when I add a rep, he will be active. The checkbox is checked when the AddNew
is clicked, but that data is never written back to my underlying data.
Everything else is written, but the IsActive field is false, despite what is
in the check box. How can I get the new rep to have the IsActive field set
to true?
The underlying database is an Access database. I have checked and it is not
set True.
The only routine to write the data back is:
Me.RepsBindingSource.EndEdit()
Me.RepsTableAdapter.Update(dt)
dt.AcceptChanges()
The rest of the data is written back, so I don't understand why the Active
field isn't.
"Flomo Togba Kwele" wrote:
Vernon,
What type of the DataSource? Dataset or customer object: Have you checked the underlying data after
it is created to make sure Active is set true?
How do you know it's the binding and not the routine to write it back? Have you checked the
underlying data just before it is written back to the DB?
Flomo
--
Vernon Peppers wrote:
I am having trouble with the binding of a check box. I have a form for
editing and adding reps. I am using a bindingsource and a bindingnavigator.
I have on the form an "Active" checkbox, which is bound to the IsActive field
in the bound data table. It works fine for the reps that are already in the
table. The problem occurs when I click on the AddNew button on the
bindingnavigator. I have the field in the table to default to true, because
when I add a rep, he will be active. The checkbox is checked when the AddNew
is clicked, but that data is never written back to my underlying data.
Everything else is written, but the IsActive field is false, despite what is
in the check box. How can I get the new rep to have the IsActive field set
to true?
Vernon,
Place this line between the EndEdit and Update methods:
Dim row As dsReps.RepsRow = DirectCast(DirectCast(RepsBindingSource.Current, DataRowView).Row,
dsReps.RepsRow)
The variable row represents a row in the dataset. I'm not sure of the dataset name and table row
name, but substitute the proper variable names. Then in debug, set a breakpoint and look at the
value of Active. Is it what you expect?
You could also use QuickWatch in debug if your familiar with walking the data structure.
--
Vernon Peppers wrote:
The underlying database is an Access database. I have checked and it is not
set True.
The only routine to write the data back is:
Me.RepsBindingSource.EndEdit()
Me.RepsTableAdapter.Update(dt)
dt.AcceptChanges()
The rest of the data is written back, so I don't understand why the Active
field isn't.
"Flomo Togba Kwele" wrote:
Vernon,
What type of the DataSource? Dataset or customer object: Have you checked the underlying data
after it is created to make sure Active is set true?
How do you know it's the binding and not the routine to write it back? Have you checked the
underlying data just before it is written back to the DB?
Flomo
--
Vernon Peppers wrote:
I am having trouble with the binding of a check box. I have a form for
editing and adding reps. I am using a bindingsource and a bindingnavigator.
I have on the form an "Active" checkbox, which is bound to the IsActive field
in the bound data table. It works fine for the reps that are already in the
table. The problem occurs when I click on the AddNew button on the
bindingnavigator. I have the field in the table to default to true, because
when I add a rep, he will be active. The checkbox is checked when the AddNew
is clicked, but that data is never written back to my underlying data.
Everything else is written, but the IsActive field is false, despite what is
in the check box. How can I get the new rep to have the IsActive field set
to true?
The only thing that this tells me is that all of the values in the table
currently are null.
"Flomo Togba Kwele" wrote:
Vernon,
Place this line between the EndEdit and Update methods:
Dim row As dsReps.RepsRow = DirectCast(DirectCast(RepsBindingSource.Current, DataRowView).Row,
dsReps.RepsRow)
The variable row represents a row in the dataset. I'm not sure of the dataset name and table row
name, but substitute the proper variable names. Then in debug, set a breakpoint and look at the
value of Active. Is it what you expect?
You could also use QuickWatch in debug if your familiar with walking the data structure.
--
Vernon Peppers wrote:
The underlying database is an Access database. I have checked and it is not
set True.
The only routine to write the data back is:
Me.RepsBindingSource.EndEdit()
Me.RepsTableAdapter.Update(dt)
dt.AcceptChanges()
The rest of the data is written back, so I don't understand why the Active
field isn't.
"Flomo Togba Kwele" wrote:
Vernon,
>
What type of the DataSource? Dataset or customer object: Have you checked the underlying data
after it is created to make sure Active is set true?
>
How do you know it's the binding and not the routine to write it back? Have you checked the
underlying data just before it is written back to the DB?
>
Flomo
--
>
>
>
>
Vernon Peppers wrote:
>
I am having trouble with the binding of a check box. I have a form for
editing and adding reps. I am using a bindingsource and a bindingnavigator.
I have on the form an "Active" checkbox, which is bound to the IsActive field
in the bound data table. It works fine for the reps that are already in the
table. The problem occurs when I click on the AddNew button on the
bindingnavigator. I have the field in the table to default to true, because
when I add a rep, he will be active. The checkbox is checked when the AddNew
is clicked, but that data is never written back to my underlying data.
Everything else is written, but the IsActive field is false, despite what is
in the check box. How can I get the new rep to have the IsActive field set
to true?
>
Vernon,
Sorry about that. There is probably no current row then. Place that code in the CheckedChanged
event of the checkbox and look at the Active column, row.Active.
--
row.Active didn't exist, and everything I tried to look at still was null.
However, I figured out a workaround to take care of my problem. My code is:
Me.RepsBindingSource.MoveFirst()
For i As Integer = 0 To Me.RepsBindingSource.Count - 1
Dim drv As DataRowView = Me.RepsBindingSource.Current
Dim row As DataRow = drv.Row
If row.RowState = DataRowState.Added Then
row.Item("IsActive") = True
End If
Me.RepsBindingSource.MoveNext()
Next
Me.RepsBindingSource.EndEdit()
Me.RepsTableAdapter.Update(dt)
If I step through this code, the value of row.Item("IsActive") is DBNull
before the statement assigning its value. Yet this box is bound to the
database. I still don't understand why it won't work. I think that we might
have a bug, but what I have done works.
"Flomo Togba Kwele" wrote:
Vernon,
Sorry about that. There is probably no current row then. Place that code in the CheckedChanged
event of the checkbox and look at the Active column, row.Active.
-- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: deko |
last post by:
I'm trying to create an MSI in VS.NET that will check for installed Office
System components - so my MDE will only install if requirements are met.
I'm thinking about using VBScript to inspect...
|
by: Bruce |
last post by:
Hi, there,
I meet a problem about comboBox binding.
--------------------
Database: Northwind
Tables: 1) Products 2) Categories
I create a form (named "form1") to edit the record from...
|
by: JSantora |
last post by:
Essentially, InsertAT is broken!
For the past couple of hours, I've been getting this "Parameter name:
'-2147483550' is not a valid value for 'index'." error.
Apparently, its caused by having...
|
by: Hardik Shah |
last post by:
Hi,
I have created data form from wizard for a table which has a field with bit
type . The table has one field with not null value .
However, I fill the field , however, it gives following...
|
by: Dave |
last post by:
If Iwant to check if dataset1.SelectQuery1.column1 ==
System.DBNull.Value. How do I do this? What I wrote above will give an error.
--
L. A. Jones
|
by: webrod |
last post by:
Hi all,
how can I check a user/password in a LDAP ?
I don't want to connect with this user, I would like to connect to LDAP
with a ADMIN_LOG/ADMIN_PWD, then do a query to find the user and...
|
by: =?Utf-8?B?Sm9iIExvdA==?= |
last post by:
how can i add a check box to binding navigator control?
thanks
|
by: haresh.amis |
last post by:
hello to all,
I m using .net 2.0 and i face a problem that is as under
Well I have a checkboxlist which i bound in .cs page
now I want to count that how many checkboxes ate checked ( In...
|
by: parez |
last post by:
Is there anyway i can find out if a control is an input control
(textbox,radiobutton,checkbox,dropdown etc)
and not a panel,group box etc.
I am trying to implement "You have unsaved data on the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
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...
|
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,...
|
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...
| |