473,513 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ValidateTextBox is not defined

3 New Member
Expand|Select|Wrap|Line Numbers
  1. Imports System.Data.OleDb
  2. Imports System.Data.SqlClient
  3.  
  4. Public Class Form2
  5.     Public connstring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\REORBETA\Desktop\COPRO VB NET PROGRAM FINALS\VB NET Database\Database\Database\Database.accdb"
  6.     Public conn As New OleDbConnection
  7.  
  8.     Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  9.         'TODO: This line of code loads data into the 'DatabaseDataSet.Status' table. You can move, or remove it, as needed.
  10.         Me.StatusTableAdapter.Fill(Me.DatabaseDataSet.Status)
  11.         'TODO: This line of code loads data into the 'DatabaseDataSet.View_Instructors' table. You can move, or remove it, as needed.
  12.         Me.View_InstructorsTableAdapter.Fill(Me.DatabaseDataSet.View_Instructors)
  13.         'TODO: This line of code loads data into the 'DatabaseDataSet.View_Courses' table. You can move, or remove it, as needed.
  14.         Me.View_CoursesTableAdapter.Fill(Me.DatabaseDataSet.View_Courses)
  15.         'TODO: This line of code loads data into the 'DatabaseDataSet.Status_Year_Level_and_Program' table. You can move, or remove it, as needed.
  16.         Me.Status_Year_Level_and_ProgramTableAdapter.Fill(Me.DatabaseDataSet.Status_Year_Level_and_Program)
  17.         'TODO: This line of code loads data into the 'DatabaseDataSet.Student_Registration' table. You can move, or remove it, as needed.
  18.         Me.Student_RegistrationTableAdapter.Fill(Me.DatabaseDataSet.Student_Registration)
  19.  
  20.         conn.ConnectionString = connstring
  21.  
  22.         'to test if the connection to the database is open
  23.         If conn.State = ConnectionState.Closed Then
  24.             conn.Open()
  25.             MsgBox("Database connection is now open")
  26.         Else
  27.             MsgBox("Database Connection has been Closed")
  28.         End If
  29.  
  30.     End Sub
  31.  
  32.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  33.  
  34.         Dim clsValidate As New ValidateTextBox
  35.  
  36.         'validating empty txtID
  37.         If clsValidate.IsTextBoxEmpty(txtID) = True Then
  38.             MessageBox.Show("Please enter ID")
  39.             Exit Sub
  40.         End If
  41.  
  42.         'validating a numeric input for ID
  43.         If clsValidate.IsTextBoxNumeric(txtID) = False Then
  44.             MessageBox.Show("Please enter a valid ID")
  45.             Exit Sub
  46.         End If
  47.  
  48.         'validating the an empty textLName
  49.         If clsValidate.IsTextBoxEmpty(txtLName) Then
  50.             MessageBox.Show("Please enter First Name")
  51.             Exit Sub
  52.         End If
  53.  
  54.         'validating a character input for LastName
  55.         If clsValidate.IsTextBoxNumeric(txtLName) = True Then
  56.             MessageBox.Show("Please enter a valid First Name")
  57.             Exit Sub
  58.         End If
  59.  
  60.         'validating the an empty textFName
  61.         If clsValidate.IsTextBoxEmpty(txtFName) Then
  62.             MessageBox.Show("Please enter First Name")
  63.             Exit Sub
  64.         End If
  65.  
  66.         'validating a character input for FirstName
  67.         If clsValidate.IsTextBoxNumeric(txtFName) = True Then
  68.             MessageBox.Show("Please enter a valid First Name")
  69.             Exit Sub
  70.         End If
  71.  
  72.         'validating the an empty textMName
  73.         If clsValidate.IsTextBoxEmpty(txtMName) Then
  74.             MessageBox.Show("Please enter Middle Name")
  75.             Exit Sub
  76.         End If
  77.  
  78.         'validating a character input for MiddleName
  79.         If clsValidate.IsTextBoxNumeric(txtMName) = True Then
  80.             MessageBox.Show("Please enter a valid Middle Name")
  81.             Exit Sub
  82.         End If
  83.  
  84.         'validating empty txtContact1
  85.         If clsValidate.IsTextBoxEmpty(txtContact1) = True Then
  86.             MessageBox.Show("Please enter Contact Number")
  87.             Exit Sub
  88.         End If
  89.  
  90.         'validating a numeric input for txtContact1
  91.         If clsValidate.IsTextBoxNumeric(txtContact1) = False Then
  92.             MessageBox.Show("Please enter a valid Contact Number")
  93.             Exit Sub
  94.         End If
  95.  
  96.         'validating the an empty txtAddress
  97.         If clsValidate.IsTextBoxEmpty(txtAddress) Then
  98.             MessageBox.Show("Please enter Address")
  99.             Exit Sub
  100.         End If
  101.  
  102.         'validating a character input for txtAddress
  103.         If clsValidate.IsTextBoxNumeric(txtAddress) = True Then
  104.             MessageBox.Show("Please enter a valid Address")
  105.             Exit Sub
  106.         End If
  107.  
  108.         'validating the an empty txtGuardian
  109.         If clsValidate.IsTextBoxEmpty(txtGuardian) Then
  110.             MessageBox.Show("Please enter Guardian Name")
  111.             Exit Sub
  112.         End If
  113.  
  114.         'validating a character input for Guardian
  115.         If clsValidate.IsTextBoxNumeric(txtGuardian) = True Then
  116.             MessageBox.Show("Please enter a valid Guardian Name")
  117.             Exit Sub
  118.         End If
  119.  
  120.         'validating empty txtContact2
  121.         If clsValidate.IsTextBoxEmpty(txtContact2) = True Then
  122.             MessageBox.Show("Please enter Contact Number")
  123.             Exit Sub
  124.         End If
  125.  
  126.         'validating a numeric input for txtContact2
  127.         If clsValidate.IsTextBoxNumeric(txtContact2) = False Then
  128.             MessageBox.Show("Please enter a valid Contact Number")
  129.             Exit Sub
  130.         End If
  131.  
  132.         'inserting the new record to database
  133.         Try
  134.             Dim SqlQuery As String = "INSERT INTO Friends (ID, Last Name, First Name, Middle Name, Contact Number, Address, Guardian, Contact Number) VALUES ('" & txtID.Text & "','" & txtLName.Text & "','" & txtFName.Text & "','" & txtMName.Text & "','" & txtContact1.Text & "','" & txtAddress.Text & "','" & txtGuardian.Text & "','" & txtContact2.Text & "')"
  135.             Dim SqlCommand As New OleDbCommand
  136.  
  137.             With SqlCommand
  138.                 .CommandText = SqlQuery
  139.                 .Connection = conn
  140.                 .ExecuteNonQuery()
  141.             End With
  142.             MsgBox("Record Succesfully Added")
  143.  
  144.             'refreshing the textbox for new record
  145.             txtID.Text = ""
  146.             txtLName.Text = ""
  147.             txtFName.Text = ""
  148.             txtMName.Text = ""
  149.             txtContact1.Text = ""
  150.             txtAddress.Text = ""
  151.             txtGuardian.Text = ""
  152.             txtContact2.Text = ""
  153.  
  154.         Catch ex As Exception
  155.             MsgBox(ex.Message)
  156.         End Try
  157.  
  158.     End Sub
  159. End Class
Oct 21 '13 #1
4 1284
MeGotLotsoQs
3 New Member
We were told to make a project that uses database, We are using VB.NET with either SQL or using MS Access, I used Access on mine since it was troublesome download since its time consuming and I have Access ready in my PC.

Having trouble with this, please help oh great programmers hehe!
Oct 21 '13 #2
pod
298 Contributor
I'll go out o a limb here and say that this is the first run at it, am I right?

If so then I suggest to use small steps:
first step,connect to the database, and display a message depending if successful or not.
Test it!
When this succeeds, add another step; get a record from a table and show the result in a message.
Test it!
... and so forth.

If this is not your first run and you were progressing well until you added the "ValidateTextBox" call then the message is telling you what is wrong, ... ValidateTextBox is not defined ... in your code a least.

If you took this portion of the code from some other project, you only got part of it; go back and look for the class named "ValidateTextBox" with its two functions; IsTextBoxEmpty, IsTextBoxNumeric ... or write your own class (the latter would be a better learning experience ;)


Good luck

P:oD
Oct 21 '13 #3
MeGotLotsoQs
3 New Member
I did test the connection to the database and it was successful. Yes, I did take this portion of validation from our three previous exercises but there were no class ValidateTextBox declared but it executes well and there were no error. Im confused with what's happening to my project, hahaha, in all four forms, the only errors I got was the same error which is "ValidateTextBox is not defined", Thank you for the reply, I will try to declare class name ValidateTextBox, I hope it will work. :)
Oct 21 '13 #4
Rabbit
12,516 Recognized Expert Moderator MVP
ValidateTextBox looks like some sort of third party control. But I don't see that you bring in the third party code anywhere.
Oct 22 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2167
by: camaro77 majau via DotNetMonster.com | last post by:
Sorry by my english but i'm from spain. I have a problem and after search by the web i have know that is due by framework. The message is : setup error "failed to load ressouces from resource...
1
1047
by: Joseph McConaughey | last post by:
Hello All, I have been working on .NET (especially C#) applications on this computer for a long time. Everything was working fine until yesterday, but when I came back into work today and tried...
3
2527
by: VB Programmer | last post by:
I am using the free rich text editor control from ExportTechnologies. Every once in a while I get this error (for no apparent reason). Sometimes it happens even when I'm working on a totally...
2
2643
by: Sean Carey | last post by:
I converted a C# Upload app to VB.NET and am down to one error and was hoping someone could help me with te error. I would greatly appreciate help from anyone. Here is the error: ...
2
4028
by: drew.ferraro | last post by:
Hi, I am trying to build a .DLL file that uses "'Microsoft.ApplicationBlocks.ExceptionManagement.Interfaces'". I am trying to build this .DLL as fully signed. However, when I try to build, I...
0
876
by: EMMAY | last post by:
Hi guys, I'm building a MFC extension dll using c++.net 2003. everything was fine before I add the flag AFX_EXT_CLASS to a managed class. but once add this flag, as following: __gc class...
0
1768
by: imranabdulaziz | last post by:
Dear All, I am making web application using Asp.net C#(Visual Studio2005). And Sql server 2005 as a back End I generated local mode report but as there was no printing option available . I assign...
9
2258
by: Debbie | last post by:
I wonder if anyone can help me out, or point me in the right direction, in solving my current problem: I have started seeing an error on one of my ASP pages. Id displays totally blank except...
0
1123
by: Alan Silver | last post by:
Hello, I'm a newbie at PHP and MySql, although I have wads of experience of ASP, ASP.NET, SQL Server, etc. I have just installed PHP 5.2.3 on a server (Windows Server 2003), as well as MySql...
1
1436
by: ramyamoparthi | last post by:
<%@ page import="java.sql.*"%> <jsp:include page="home.jsp" /> <div style="left:200;top:0;height:100%;width:800;background-color:#d6d6d6;position:absolute"> <HTML> <HEAD> <TITLE> Add B.Tech...
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7161
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5089
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3234
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.