0

What is the way to implement/mimic the Windows message popup that a user gets when, for instance when you try to rename a folder on the desktop using invalid characters?
enter image description here

I want to use this method in lieu of a message box.

busarider29
  • 185
  • 5
  • 18
  • Would control validation fit the bill? Example here: http://www.codeproject.com/Articles/13922/Validate-user-input-in-Windows-Forms – Matt Hanson Jun 15 '16 at 19:39
  • Try one of these answers: http://stackoverflow.com/questions/7541767/how-can-i-show-a-balloon-tip-over-a-textbox – John Koerner Jun 15 '16 at 19:41
  • 2
    Just use a ToolTip component, set the IsBalloon property to true. See [How to show a .NET Balloon ToolTip?](http://stackoverflow.com/q/8716917/719186) – LarsTech Jun 15 '16 at 19:43

1 Answers1

0

You can achieve this by using ErrorProvider. It is located in your toolbox. Just drag and drop it into your form. To use it, example code

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
    If TextBox1.Text.Trim().Length > 6 Then
        ErrorProvider1.SetError(TextBox1, "Input is too long!")
    End If
End Sub

enter image description here

Method 2 : Using ToolTip. This can be found in your toolbox as well. Just drop it into your form and in the properties window, you can set the "tip" for each controls in your form. enter image description here

Here is how it will look like when your cursor is hovering the controls. enter image description here

If you dislike the rectangle pop up, you can change it to a ballon pop up by isBallon = true. enter image description here

Student
  • 432
  • 2
  • 10
  • 30