|
-
May 31st, 2002, 12:06 PM
#1
Thread Starter
New Member
Why can't I add records to a data set when I bind a check box?
I have an application that works great when I'm only using text boxes for adding information to a record. However, when I try to bind the check boxes to a data set, I get strange results. I have bound the control using the Checked property in the DataBindings section. When I try to add a record, the text box displaying the data set's position is updated, but I can't get to the record to add any information. Has anybody else experienced this?
-
Jun 3rd, 2002, 12:31 PM
#2
Hyperactive Member
seem to remember I had something similar, post the code and I'll see if it was anything like my own problem and I'll post back the solution I came up with
-
Jun 3rd, 2002, 12:46 PM
#3
Thread Starter
New Member
Code for this issue...
Thanks for all of your help!
Like I said, this code works until I bind a check box to the dataset. Here's the code I have now to add a new record:
Private Sub mnuEditAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditAdd.Click
With Me.BindingContext(dsCustomer, "tblCustomer")
.EndCurrentEdit()
.AddNew()
End With
Me.ChangePosition()
SetButtonState(ButtonState.Inactive)
End Sub
Private Sub ChangePosition()
'update the text box for the record information
txtRecords.Text = "Record " & Me.BindingContext(dsCustomer, "tblCustomer").Position + 1 & _
" of " & Me.BindingContext(dsCustomer, "tblCustomer").Count
Me.daTerminal.Update(dsCustomer)
End Sub
Private Sub SetButtonState(ByVal State As ButtonState)
If State = ButtonState.Active Then
btnFirst.Enabled = True
btnPrevious.Enabled = True
btnNext.Enabled = True
btnLast.Enabled = True
mnuEditAdd.Enabled = True
mnuEditDelete.Enabled = True
mnuEditCancel.Enabled = False
Else
btnFirst.Enabled = False
btnPrevious.Enabled = False
btnNext.Enabled = False
btnLast.Enabled = False
mnuEditAdd.Enabled = False
mnuEditDelete.Enabled = False
mnuEditCancel.Enabled = True
End If
End Sub
Jeff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|