Windows Develop Bookmark and Share   
 index > Windows Forms General > How do I get the table to accept input into a form written via a program.
 

How do I get the table to accept input into a form written via a program.

If I write to a text box via a program, the table attached to the form is not updated until I navigate to the next form record. Presumably the Form locator.position change accepts and confirms the value to the table.

 

The Data Table is not linked to a SQL database or MS Access but I read and write to it from text files so I can not to an sql COMMIT.

 

On occasion, the field will display the value sent but the underlying table ignores it. So I need an “Enter�like event to commit or confirm it in the table.
John Spencer  Tuesday, December 13, 2005 4:04 PM
 John Spencer wrote:
Remco,
Don't worry if you can not help here but I took a look at your suggestion and these methods seem to apply to editing datatables directly, i.e not to form entry.


It should'nt matter if there is a connection

 John Spencer wrote:


My problem here comes about with a form tab. When a user updates a form, a last update value is set on the record via one of the text box fields, which is bound to the datatable upon which the form is based. This Form/Datatable is part of a TabControl.

Normally this works fine but when I change to another tab, the update of this text box is ignored.



This statement is commiting pending changes back to the datatabel
connected or Not. it doesn't matter

BindingContext(YouTabel.DefaultView).EndCurrentEdit()
maybe - Yourtabel.AcceptChanges()

 John Spencer wrote:

In detail, user edits data in form Tab 1 based on datatable X then clicks on another tab to go to Tab 2 (another form within the tabcontrol object). To update the last update, the Form_leaving trigger in Tab1 writes date/time into last_update text box of Tab 1 I think you could call here endcurrendedit and then goes to Tab 2. If I go back to Tab 1 the last update change has been ignored.

Hence what I want is some form of Form enter type command ("ENTER" in Oracle Forms!) which commits the last update to the table. I have tried writing the date directly to the table but this then ignores the changes the user made originally.



If i understand correctly(probably not i'm not natve english), you want to know
1. a event when a form is activated
   use the activate event (duh) on the form
or
   You want to know when the recordpointer is changed ?
   
   declare a valiable like this
      Private
WithEvents _Navigator As BindingManagerBase

   after creation of your table
     _navigator = BindingContext(_Tabel)

 then handle the positionchanged event on the _navigator variable

else
   sorry

Remco

RemcoJVG  Wednesday, December 14, 2005 5:10 PM
Hi john

I'm not shure what you're asking for but take a look at the endcurrendedit method

Remco
RemcoJVG  Wednesday, December 14, 2005 10:52 AM
Remco,
Don't worry if you can not help here but I took a look at your suggestion and these methods seem to apply to editing datatables directly, i.e not to form entry.

My problem here comes about with a form tab. When a user updates a form, a last update value is set on the record via one of the text box fields, which is bound to the datatable upon which the form is based. This Form/Datatable is part of a TabControl.

Normally this works fine but when I change to another tab, the update of this text box is ignored.

In detail, user edits data in form Tab 1 based on datatable X then clicks on another tab to go to Tab 2 (another form within the tabcontrol object). To update the last update, the Form_leaving trigger in Tab1 writes date/time into last_update text box of Tab 1 and then goes to Tab 2. If I go back to Tab 1 the last update change has been ignored.

Hence what I want is some form of Form enter type command ("ENTER" in Oracle Forms!) which commits the last update to the table. I have tried writing the date directly to the table but this then ignores the changes the user made originally.

It may be something to do with my set up here not being MS standard, i.e. Form bound directly to DataTable with no connection of datatable to standard SQL database or Access.  

If you can't help thanks anyway.

John Spencer  Wednesday, December 14, 2005 3:56 PM
 John Spencer wrote:
Remco,
Don't worry if you can not help here but I took a look at your suggestion and these methods seem to apply to editing datatables directly, i.e not to form entry.


It should'nt matter if there is a connection

 John Spencer wrote:


My problem here comes about with a form tab. When a user updates a form, a last update value is set on the record via one of the text box fields, which is bound to the datatable upon which the form is based. This Form/Datatable is part of a TabControl.

Normally this works fine but when I change to another tab, the update of this text box is ignored.



This statement is commiting pending changes back to the datatabel
connected or Not. it doesn't matter

BindingContext(YouTabel.DefaultView).EndCurrentEdit()
maybe - Yourtabel.AcceptChanges()

 John Spencer wrote:

In detail, user edits data in form Tab 1 based on datatable X then clicks on another tab to go to Tab 2 (another form within the tabcontrol object). To update the last update, the Form_leaving trigger in Tab1 writes date/time into last_update text box of Tab 1 I think you could call here endcurrendedit and then goes to Tab 2. If I go back to Tab 1 the last update change has been ignored.

Hence what I want is some form of Form enter type command ("ENTER" in Oracle Forms!) which commits the last update to the table. I have tried writing the date directly to the table but this then ignores the changes the user made originally.



If i understand correctly(probably not i'm not natve english), you want to know
1. a event when a form is activated
   use the activate event (duh) on the form
or
   You want to know when the recordpointer is changed ?
   
   declare a valiable like this
      Private
WithEvents _Navigator As BindingManagerBase

   after creation of your table
     _navigator = BindingContext(_Tabel)

 then handle the positionchanged event on the _navigator variable

else
   sorry

Remco

RemcoJVG  Wednesday, December 14, 2005 5:10 PM
Remco, I've got another solution but thanks a lot for your help.
John Spencer  Thursday, December 15, 2005 2:32 PM

You can use google to search for other answers

Custom Search

More Threads

• Bug in NumericUpDown control
• Preventing an item from highlighting in a checkedlistbox.
• ComboBox AutoUpdate OnEnter KeyPressed - Bug or Feature?
• VS 2008 RTM samples
• Exiting from a UserControl Prematurely
• Prohibit resizing of child windows??? C#
• Set Background Color on TabControl in VS2005/VB
• How to reflect Selected listBox items from One Form to Another Form.
• Problem with Click not firing in the TableLayoutPanel
• Updating multiple pictureBoxes simultaneously