Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

In my window application for validation purpose i need to prompt the error if the user missed to tag the content. The content showned in the text box.In the below code & sHint having the particular line.i found where the tag missed.But i want to keep position of the cursor in the starting line?.how to keep the cursor in sHint?

In otherway how to highlight the sHint value in textbox

VB
If MsgBox("Pg-Ref (or) cross-ref tagged without ref-group tag" & vbCrLf & vbCrLf & "Hint=>" & sHint & vbCrLf & vbCrLf & "Are you sure to close?", vbYesNo) = vbNo Then
Exit Sub
End If
Posted
Updated 28-Oct-13 21:00pm
v3

1 solution

i did not understand the question very well, but you can use the string.IndexOf() to get the postion of a word in a paragraph!
C#
string msg = "abcdefghijklm...";
int index = msg.IndexOf("fghi"); // the value is 5 in this case
//if the word dont exsist, you will get an exception so better test if the word exsist before getting the index.

if(msg.IndexOf("fghi") != -1)
{
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900