I am new to VB.net and web programming, I would like to keep the data
from a text box when doing some validation. I know there is a
validation control but unfortunately we can't use it (don't ask, gov't
set those standards). If I have data entered, say in the 1st text box,
the function catches the second text box as empty but removes the data
from the 1st text box when I click the button. How do I keep the data
in the text boxes when it posts back to the same page?

Thanks,

William.


I have a button on the page, the clicked event fires a function called
CheckMandatoryFields() ;

Clicked event:
If Not CheckMandatoryFields() Then
    Exit Sub
End If

Function CheckMandatoryFields() As Boolean

    Dim ls_current_password As String = Nothing
    Dim ls_new_password As String = Nothing
    Dim ls_confirm_password As String = Nothing

    ls_current_password = Me.txtCurrentNDWLPassword.Text
    ls_new_password = Me.txtnewPassword.Text
    ls_confirm_password = Me.txtconfirmPassword.Text

    If ls_current_password = Nothing Then
      lblErr.Text =
Me.GetLocalResourceObject("appMsgCurrentPWNull").ToString
      lblErr.Visible = True
      Return False
    ElseIf ls_new_password = Nothing Then
      lblErr.Text =
Me.GetLocalResourceObject("appMsgNewPWNull").ToString
      lblErr.Visible = True
      Me.txtnewPassword.Focus()
      Return False
    ElseIf ls_confirm_password = Nothing Then
      lblErr.Text =
Me.GetLocalResourceObject("appMsgConfirmPWNull").ToString
      lblErr.Visible = True
      Me.txtconfirmPassword.Focus()
      Return False
    End If

    Return True


  End Function

Reply via email to