Wrox Programmer Forums
Visual Basic 2008 Professionals For advanced Visual Basic coders working in version 2008. Beginning-level questions will be redirected to other forums,
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 16th, 2014, 09:35 AM
Registered User
Join Date: Mar 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Validate from textbox

hei, i'm new to this forum, i'm here to ask you about my problem in vb.net
how can i validate an user input from textbox, but you have to validate it on your notepad, so if that user input don't have in notepad, it won't validate, but if it has then it validate, this is my code, but in there if i input from textbox it save to the notepad not validate

Imports System.IO

Public Class TryCatch
Dim sFileName As String = Application.StartupPath & "\email.txt"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myFileStream As New System.IO.FileStream(sFileName, FileMode.Open, FileAccess.ReadWrite, FileShare.Read)
Dim myReader As New System.IO.StreamReader(myFileStream)
Dim sFileContents As String = myReader.ReadToEnd()
TextBox1.Text = sFileContents
Catch ex As Exception
End Try
End Sub

Function ValidateEmail(ByVal email As String) As Boolean
Dim emailRegex As _
New System.Text.RegularExpressions.Regex( _
Dim emailMatch As _
System.Text.RegularExpressions.Match = emailRegex.Match(email)
Return emailMatch.Success
End Function

Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
Dim sFileName As String = OpenFileDialog1.FileName.ToString()
Dim data() As String
Dim dataPerLine As String = Nothing
Dim ItemList As ListViewItem
Dim MyFileStream As System.IO.FileStream
MyFileStream = New System.IO.FileStream(sFileName, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.None)

If MyFileStream.CanRead = True Then
Dim MyReader As New System.IO.StreamReader(MyFileStream)
While (Not MyReader.EndOfStream)
dataPerLine = MyReader.ReadLine()
data = dataPerLine.Split(New Char() {Chr(9)})
ItemList = New ListViewItem(data)
End While
End If
End Sub
End Class
Old March 25th, 2014, 01:18 AM
Friend of Wrox
Join Date: Feb 2014
Posts: 136
Thanks: 1
Thanked 10 Times in 10 Posts

What do you mean by validate a text box on your notepad.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript to validate a textbox abhishekkashyap27 Javascript 9 May 6th, 2008 02:41 AM
hi help me to write javascript to validate textbox karthikc85 XML 1 October 12th, 2006 03:12 AM
Validate two textbox one for area code and number debjanib ASP.NET 1.0 and 1.1 Professional 1 June 6th, 2006 01:00 PM
validate textbox stoneman Access 5 January 30th, 2004 11:49 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.