Comparison of text in textbox

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2006
Posts: 4
Reputation: Manithan is an unknown quantity at this point 
Solved Threads: 0
Manithan Manithan is offline Offline
Newbie Poster

Comparison of text in textbox

 
0
  #1
Nov 15th, 2006
Hi im doing a application tool which will check for spoof email headers. now i want to do some comparison of text in textbox

can anyone help me in this?

thank you
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Comparison of text in textbox

 
0
  #2
Nov 15th, 2006
Sure which part are you stuck on?
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 4
Reputation: Manithan is an unknown quantity at this point 
Solved Threads: 0
Manithan Manithan is offline Offline
Newbie Poster

Re: Comparison of text in textbox

 
0
  #3
Nov 16th, 2006
Originally Posted by iamthwee View Post
Sure which part are you stuck on?
HI thanks for ure reply

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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Comparison of text in textbox

 
0
  #4
Nov 16th, 2006
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.

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*
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 4
Reputation: Manithan is an unknown quantity at this point 
Solved Threads: 0
Manithan Manithan is offline Offline
Newbie Poster

Re: Comparison of text in textbox

 
0
  #5
Nov 16th, 2006
Originally Posted by iamthwee View Post
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.
Can u show me the codes for it?

Thank u
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 262
Reputation: Dukane is an unknown quantity at this point 
Solved Threads: 22
Dukane's Avatar
Dukane Dukane is offline Offline
Posting Whiz in Training

Re: Comparison of text in textbox

 
0
  #6
Nov 16th, 2006
I think you want to use the equals method here to check if they are equal, that is, the same string.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 4
Reputation: Manithan is an unknown quantity at this point 
Solved Threads: 0
Manithan Manithan is offline Offline
Newbie Poster

Re: Comparison of text in textbox

 
0
  #7
Nov 21st, 2006
Originally Posted by Dukane View Post
I think you want to use the equals method here to check if they are equal, that is, the same string.
Hi

Can u show me the codes for it ???i still trying but its not wokin coz once i click the button it not comparing the text in the textbox...
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Comparison of text in textbox

 
0
  #8
Nov 21st, 2006
I honestly can't see how you don't understand this?

  1. Dim var As String = "www.google.com"
  2.  
  3. Dim test As String = "www.google.com"
  4.  
  5. If test = var Then
  6. MsgBox("match")
  7. End If
  8.  
  9. Else
  10. MsgBox("wrong")
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 262
Reputation: Dukane is an unknown quantity at this point 
Solved Threads: 22
Dukane's Avatar
Dukane Dukane is offline Offline
Posting Whiz in Training

Re: Comparison of text in textbox

 
0
  #9
Nov 21st, 2006
It's not working because you never check the contents of the textbox in your code.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Comparison of text in textbox

 
0
  #10
Nov 23rd, 2006
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 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.
Last edited by iamthwee; Nov 23rd, 2006 at 4:33 pm.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC