Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > Visual Basic 2008 Professionals
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 16th, 2014, 09:35 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Try
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
myReader.Close()
myFileStream.Close()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub

Function ValidateEmail(ByVal email As String) As Boolean
Dim emailRegex As _
New System.Text.RegularExpressions.Regex( _
"^(?<user>[^@]+)@(?<host>.+)$")
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
MyReader.Close()
MyFileStream.Close()
End If
End Sub
End Class
Reply With Quote
  #2 (permalink)  
Old March 25th, 2014, 01:18 AM
Friend of Wrox
Points: 528, Level: 8
Points: 528, Level: 8 Points: 528, Level: 8 Points: 528, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2014
Posts: 136
Thanks: 1
Thanked 10 Times in 10 Posts
Default

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


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 10:49 AM



All times are GMT -4. The time now is 09:34 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.