Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to validate a Key Field in a TextBox
Message
From
05/10/2004 18:18:45
David Fúnez
Inversiones Comerciales
Tegucigalpa, Honduras
 
 
To
All
General information
Forum:
Visual Basic
Category:
Other
Title:
How to validate a Key Field in a TextBox
Miscellaneous
Thread ID:
00948972
Message ID:
00948972
Views:
60
Hello;

I need to validate when the users pulses TAB/ENTER for leaving a textbox, the user writes a "Code number" so i need to verify against a DataBase if it exists or not.

The database i use is VistaDB http://www.vistadb.net.

By now wath i've done is this, but the "Catch", it launches an error message "Mus Specify a DataSource Prior to Open" when i write a Code Number in the Textbox and press TAB:

Private Sub TextBox1_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
Dim valor As String
valor = TextBox1.Text

Dim cn As New VistaDB.VistaDBConnection
Dim cm As New VistaDB.VistaDBCommand
Dim dr As VistaDB.VistaDBDataReader

cn.ConnectionString = "data source=Kardex;initial catalog=Proveedores;integrated security=SSPI;"

Try
cn.Open()
Catch ex As Exception
MsgBox("Error :" + ex.Message)
End Try
End Sub

can you help with this?
In VFP is easy but in VB.NET i can get it.
David Fúnez
Tegucigalpa, Honduras
davidff@correo.de

"Piracy kill Ideas ..."
Next
Reply
Map
View

Click here to load this message in the networking platform