Visual Basic - Comprobar TextBox vacios

Written by lopezatienza on 29 Octubre 2008 – 14:26 -


Creamos nuestro Proyecto.

Agregamos 4 TextBox llamados: "tbnombre" , "tbdireccion" , "tbedad" , "tbtelefono"

Agregamos un Button llamado "btnaceptar"



Introducimos el siguiente código en "Form1.vb"


Public Class Form1

 

    Private Sub btnaceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaceptar.Click

        If tbnombre.Text = "" Or tbdireccion.Text = "" Or tbedad.Text = "" Or tbtelefono.Text = "" Then

            MsgBox("Rellene todos los campos por favor")

        Else : MsgBox("Aceptado")

            tbnombre.Clear()

            tbdireccion.Clear()

            tbedad.Clear()

            tbtelefono.Clear()

        End If

    End Sub

End Class


Tags:
Posted in Visual Basic .NET |

2 Comments to “Visual Basic - Comprobar TextBox vacios”

  1. hector garcia Says:

    gracias esta perfecta la solucion par .net

  2. lopezatienza Says:

    Me alegro de que te sirviera de ayuda.

    Un saludo!

Leave a Comment

RSS