| | |
Comparison of text in textbox
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2006
Posts: 4
Reputation:
Solved Threads: 0
HI thanks for ure reply
Im stuck on the comparison part
From: ""
Received:""
I did this but it is not working...it doesnt comparing..coz if the from and received from is same then its genuine else it is spoofed...
Can you help me on this?
Thanks.
Im stuck on the comparison part
From: ""
Received:""
Dim Text1 AsString = "Received:""" Dim Text2 As String = "From:""" If String.Compare(Text1, Text2, True) = 1 Then MsgBox("Genuine Email") End If If String.Compare(Text1, Text2, False) = 0 Then MsgBox("Spoofed Email") End If If TextBox2.Text = "" Then MessageBox.Show("You must enter something in the text box") End If
I did this but it is not working...it doesnt comparing..coz if the from and received from is same then its genuine else it is spoofed...
Can you help me on this?
Thanks.
Last edited by tgreer; Nov 21st, 2006 at 2:35 pm. Reason: Added code tags, removed non-code formatting.
Are you sure your compare method is correct?
For example if both strings are identical is the value equal to 1, like you have put or is it equal to 0.
I think it is equal to 0.
For example if both strings are identical is the value equal to 1, like you have put or is it equal to 0.
I think it is equal to 0.
•
•
•
•
Comparing Strings
The Compare method compares two strings and returns an integer value. The return value of Compare method can be less than zero, greater than zero or equals to zero.
Value Meaning
Less than zero When first string is less than second.
Zero When both strings are equal.
Greater than zero When first string is greater than zero.
*Voted best profile in the world*
I honestly can't see how you don't understand this?
VB.NET Syntax (Toggle Plain Text)
Dim var As String = "www.google.com" Dim test As String = "www.google.com" If test = var Then MsgBox("match") End If Else MsgBox("wrong")
*Voted best profile in the world*
•
•
•
•
Dim var As String = "www.google.com"
Dim test As String = "www.google.com"
If test = var Then
MsgBox("match")
End If
Else
MsgBox("wrong")
Hi Thanx for ure code...but this not the code that im sayin abt....act i dunnoe to compare a string within a string eg:From:"BOB" and Received:"Lisa" have to compare that both from a chunk of email headers from the microsoft outlook..coz im doin a application tool to detect for spoofed email..so i have to compare the 2 field from:"" & received:"" field....if "BOB" and "LISA" r the same den its genuine email else its spoofed....its like compare string within string...i hope u get wad i mean here...thank u very much....it will b a great help if u can help me on dis....
You need to google 'searching for substrings within a string'. I know vb.net has a method for this.
Last edited by iamthwee; Nov 23rd, 2006 at 4:33 pm.
*Voted best profile in the world*
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: Filling list box with available date formats
- Next Thread: Help, Adding data into db ?
| Thread Tools | Search this Thread |
.net .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons center click code combo cpu cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse editvb.net employees excel exists fade filter forms html images isnumericfuntioncall listview map mobile module msaccess mssqlbackend mysql net number objects open pan panel pdf picturebox picturebox2 port position print printing printpreview read record regex reuse right-to-left save search serial settings shutdown socket sorting sqldatbase sqlserver storedprocedure temp textbox timer timespan transparency txttoxmlconverter usercontol vb vb.net vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web winforms wpf wrapingcode xml year






