Dim Text1 AsString = "Received:"""
Dim Text2 As String = "From:"""
If String.Compare(Text1, Text2, True) = 1 Then
If String.Compare(Text1, Text2, False) = 0 Then
If TextBox2.Text = "" Then
MessageBox.Show("You must enter something in the text box")
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...
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 say you don't know how to compare a string within a string.
You need to google 'searching for substrings within a string'. I know vb.net has a method for this.
private sub CheckIfEmailsHaveSameDomain(Email1 as string,Email2 as string)
if email1.indexof(domain) >= 1 then
msgbox(" First Email From Yahoo")
msgbox("First Email Not From Yahoo")
if email2.indexof(domain) >= 1 then
msgbox(" Second Email From Yahoo")
msgbox(" Second Email Not From Yahoo")
If you want another word change domain to something else
consider 2 textbox.first one is for holding a simple statement.second one is for holding paragraph.if a particular word exist in both the textboxes means ,it need to prompt an error(don't forget the second textbox contains paragraph)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim aWord As String = "Hello"
If TextBox1.Text.Contains(aWord) Or TextBox2.Text.Contains(aWord) Then
MessageBox.Show("The word '" & aWord & "' has been found in any of the textboxes.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
the word is case sensitive, besides this is a 5 Years old thread, you could of have made a new thread instead of bumping this one