this is the sample code that I am implementing your suggestions but the Regex.replace obviously give me the blue line under telling me that is not defined.
Inherits System.Windows.Forms.Form
Dim dr As DataRow
Dim SocSecNum As New Binding("text", ObjDatos_personales_sol1, "Datos_personales_sol.num_control")
Private I As Integer
'{Me.Page0, Me.Page1, Me.Page2, Me.Page3, Me.Page4, Me.Page5, Me.Page6, Me.page7, Me.Page8, Me.Page9, Me.Page10, Me.Page11, Me.Page12, Me.page13, me.page14})
Private Sub ENTREVISTA_INITIAL_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler Riesgo_DataGrid1.MouseUp, AddressOf Riesgo_datagrid1_mouseup
AddHandler Off_site_DataGrid1.MouseUp, AddressOf Off_site_DataGrid1_MouseUp
AddHandler SocSecNum.Format, AddressOf DrafSSto_FormatSS
AddHandler SocSecNum.Parse, AddressOf FormatSSto_drafSS
'AddHandler Socio_Econo_grid.CurrentCellChanged, AddressOf Socio_Econo_grid_currentcellchanged
Try
'Attempt to load the dataset.
Me.LoadDataSet()
Me.LoadDataset4()
Me.BindingContext(ObjDatos_personales_sol1, "Datos_personales_sol").EndCurrentEdit()
dr = ObjDatos_personales_sol1.Tables(0).NewRow()
dr(0) = Space(1)
dr(3) = Space(1)
dr(4) = Space(1)
ObjDatos_personales_sol1.Tables(0).Rows.Add(dr)
Me.BindingContext(ObjDatos_personales_sol1, "Datos_personales_sol").Position = ObjDatos_personales_sol1.Tables(0).Rows.Count - 1
Me.TextBox2.DataBindings.Add(SocSecNum)
Catch eLoad As System.Exception
'Add your error handling code here.
'Display error message, if any.
System.Windows.Forms.MessageBox.Show(eLoad.Message)
End Try
I = 0
End Sub
Public Sub DrafSSto_FormatSS(ByVal sender As Object, ByVal cevent As ConvertEventArgs)
cevent.Value = regex.replace((string) cevent.Value, "(\d{3})(\d{2})(\d{4})", "$1-$2-$3")
End Sub
Public Sub FormatSSto_DrafSS(ByVal Sender As Object, ByVal cevent As ConvertEventArgs)
cevent.Value = regex.replace((string) cevent.Value, "(\d{3})(\d{2})(\d{4})", "$1-$2-$3")
End Sub