none
inputbox - not responding RRS feed

  • Question

  • Hi Expert,

    I have a code and the result after validation it will not continue the process once I click the submit button.


    Private Sub QtyRequested_Validated(sender As Object, e As EventArgs) Handles QtyRequested.Validated
    
        Try
    
    
    
            Dim answer As Integer = Plus(CType(ComboBox3.Text, Integer), CType(QtyRequested.Text, Integer))
            'Dim answer As Integer = Minus(Integer.Parse(Label23.Text), Integer.Parse(TextBox3.Text))
    
            Dim number1, number2 As Integer
            number2 = CInt(QtyRequested.Text)
            number1 = CInt(ComboBox3.Text)
    
    
    
            'Label23.Text = CType(answer, String)
    
    
    
    
    
            If answer > CInt(ComboBox5.Text) Then
    
                Dim password As String
    
                Beep()
    
                password = InputBox("Call Procurement Department to give you a permission.", "Special Permission", "Your Pass Code Here!")
    
    
                If password = "!(*!" Then
    
                    'MessageBox.Show("Welcome", "OK")
    
                    MessageBox.Show("You may now proceed proceed with the process. ", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
    
    
                Else
    
    
                    MessageBox.Show("Sorry We can't process your request", "Denied", MessageBoxButtons.OK, MessageBoxIcon.Information)
    
                    'MessageBox.Show("We can't process your request", "Not OK", MessageBoxIcon.Error)
                    QtyRequested.Text = "0"
                    'QtyRequested.Select()
    
                    Exit Sub
    
    
                End If
    
    
            End If
    
    
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    
    End Sub


    Tuesday, September 25, 2018 5:02 AM

Answers

  • Hi

    Don't know what SezMe is talking about - why would that string be excluded?

    Anyway, I tried your code (as below) and all seems to work correctly. Where does it fail for you?

    Option Strict On
    Option Explicit On
    Public Class Form1
      Private Sub QtyRequested_Validated(sender As Object, e As EventArgs) Handles QtyRequested.Validated
        Dim password As String = InputBox("Call Procurement Department to give you a permission.", "Special Permission", "Your Pass Code Here!")
        If password = "!(*!" Then
          MessageBox.Show("You may now proceed proceed with the process. ", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
          MessageBox.Show("Sorry We can't process your request", "Denied", MessageBoxButtons.OK, MessageBoxIcon.Information)
          QtyRequested.Text = "0"
        End If
        MessageBox.Show("This code worked as expected", "Code OK")
      End Sub
    End Class



    Regards Les, Livingston, Scotland


    • Edited by leshay Tuesday, September 25, 2018 11:36 AM
    • Marked as answer by antonio-jr Wednesday, September 26, 2018 12:06 AM
    Tuesday, September 25, 2018 11:32 AM

All replies

  • Because no password can pass this If statement:

     If password = "!(*!" Then

    What is the test you are trying invoke to allow a password to be acceptable.

    Tuesday, September 25, 2018 9:57 AM
  • the idea is that, the inputbox does not accept password string property like (*). SO I used combination of special character.


    Tuesday, September 25, 2018 10:06 AM
  • Hi

    Don't know what SezMe is talking about - why would that string be excluded?

    Anyway, I tried your code (as below) and all seems to work correctly. Where does it fail for you?

    Option Strict On
    Option Explicit On
    Public Class Form1
      Private Sub QtyRequested_Validated(sender As Object, e As EventArgs) Handles QtyRequested.Validated
        Dim password As String = InputBox("Call Procurement Department to give you a permission.", "Special Permission", "Your Pass Code Here!")
        If password = "!(*!" Then
          MessageBox.Show("You may now proceed proceed with the process. ", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
          MessageBox.Show("Sorry We can't process your request", "Denied", MessageBoxButtons.OK, MessageBoxIcon.Information)
          QtyRequested.Text = "0"
        End If
        MessageBox.Show("This code worked as expected", "Code OK")
      End Sub
    End Class



    Regards Les, Livingston, Scotland


    • Edited by leshay Tuesday, September 25, 2018 11:36 AM
    • Marked as answer by antonio-jr Wednesday, September 26, 2018 12:06 AM
    Tuesday, September 25, 2018 11:32 AM

  • I have a code and the result after validation it will not continue the process once I click the submit button.


    @antonio-jr -

    When posting code samples please use the "Insert Code Block" feature
    of the forum editor. It's a button near the right end of the menu bar,
    second from the right. That does a much better job of keeping the code 
    intact and readable, including handling tab characters, etc.

    - Wayne

    Tuesday, September 25, 2018 11:53 AM
  • Hi Wayne,

    THank you for the comment, actually I did again using validation, before insert button. It works but I don't have chance to put some password character that the user doesn't see my password. Like for example (*****).   

    It is works after I clean and rebuild again. 

    Once again, thank you for the comment.

    Wednesday, September 26, 2018 12:06 AM
  • https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-create-a-password-text-box-with-the-windows-forms-textbox-control

    That link shows how to create a password text box.


    • Edited by SezMe Wednesday, September 26, 2018 2:34 AM
    Wednesday, September 26, 2018 2:33 AM