Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Formatted data is not saved correctly

$
0
0

Using MS Access back end. The ID field is a text field of 4 characters. 4 characters are required, and so if a product ID has less than 4 characters, the ID field gets padded to make 4 characters:

Private Sub IDTextBox_Validating(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles IDTextBox.Validating
    While Len(IDTextBox.Text) < 4
        IDTextBox.Text = CStr("0" + CStr(IDTextBox.Text))
    End While
End Sub
When the user clicks the Save button to save the data, the leading zeros are dropped.
Private Sub SaveData()    Me.Validate()
    Me.TblProductsBindingSource.EndEdit()    Me.TableAdapterManager.UpdateAll(Me.StewardDataSet)
End Sub
Why does this happen? And how do I overcome this?

Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>