Currencymanager.addnew or Dataset.Tables("Name").NewRow

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I'm sure many of you would have done this before. I'm databinding
textboxes, and adding a newrow using,
Dataset.Tables("Name").NewRow and setting the position of the
currencymanager, but this doesn't clear the textboxes, even when I explicitly
clear them.

If I use Currencymanager.Addnew, when I save the row, I don't get the new
values.
I prefer the first method, the only thing I need there is how to clear
the values.

Does anyone have any idea?

Thanks in advance,
Debi
 
Can anyone tell me what's wrong here. I can see the textbox value being
cleared, in the watch window, but when the form loads, the values are still
there.

*****************************************************
Public Sub ResetFields()
Dim nextCount As Int16
Dim GrpBox As New GroupBox
Try
For iCount = 0 To Me.Controls.Count - 1
Select Case Me.Controls(iCount).GetType.Name
Case "GroupBox"
GrpBox = Me.Controls(iCount)
For nextCount = 0 To GrpBox.Controls.Count - 1
Select Case
GrpBox.Controls(nextCount).GetType.Name
Case "TextBox"
GrpBox.Controls(nextCount).Text = ""
Case "Combobox"
CType(GrpBox.Controls(nextCount),
ComboBox).SelectedIndex = 0
End Select
Next

End Select
Next
******************************************
 
I thought the recommendation was to not try to set/clear the fields
yourself, but just call the currencymanager.AddNew??
 
Whether I call currencymanager.Addnew or NewRow, it doesn't make any
difference here. I already have the code in place for NewRow, and I don't
want to go after how to get the row values when using Addnew.

My problem is, the form is not cleared in the form_load event, I tried both
Addnew and NewRow, both doesn't clear it.
If I call it on a button Click, the fields are cleared.
Someone please help me.................
 
Cleared on Form Load? I'm a bit confused. If you have bound controls, the
text values will be autopopulated when the form loads. So in AddNew, you
call Form Load also?

I would think that AddNew would clear all the current values, and you would
have a blank form. Then no need to invoke Form_Load??

Jeff
 
I have a form which loads when user clicks a button to add new row. So I need
the Addnew in the form load event of this new form. But it always loads with
the data for the first row. How do I clear these fields. I'm positioning the
currency manager to the new row, but when the form loads it shows the first
row.
 
Like I said, I don't think your architecture is correct. So now you have 2
forms that are bound to the same table?? Perhaps the popup form should not
be bound at all, but simply there to provide values to the bound controls on
form 1.

On form 1, call add new, then popup your non-bound entry form2. On OK on
form1, populate the fields back in form 1, then Update.

Jeff
 
Back
Top