Click here to Skip to main content
15,891,248 members
Home / Discussions / C#
   

C#

 
QuestionTaking over another window Pin
Member 239309213-Sep-05 13:11
Member 239309213-Sep-05 13:11 
AnswerRe: Taking over another window Pin
Mohamad Al Husseiny13-Sep-05 14:04
Mohamad Al Husseiny13-Sep-05 14:04 
QuestionSingle Instance Form? Pin
MrR_13-Sep-05 11:16
MrR_13-Sep-05 11:16 
AnswerRe: Single Instance Form? Pin
QuietKnight13-Sep-05 11:27
QuietKnight13-Sep-05 11:27 
AnswerRe: Single Instance Form? Pin
Mohamad Al Husseiny13-Sep-05 11:51
Mohamad Al Husseiny13-Sep-05 11:51 
GeneralRe: Single Instance Form? Pin
MrR_13-Sep-05 12:17
MrR_13-Sep-05 12:17 
QuestionGrab Text From Other Window Pin
Afief13-Sep-05 11:06
Afief13-Sep-05 11:06 
AnswerRe: Grab Text From Other Window Pin
Mohamad Al Husseiny13-Sep-05 16:28
Mohamad Al Husseiny13-Sep-05 16:28 
If You use RichTextBox you can use GetCharIndexFromPosition to get the word
this simple example
private string GetWordFromPos(Point p)
{
	string word;
	int cIdx=richTextBox1.GetCharIndexFromPosition(p);
	//go left
	int startPos;
	for(startPos=cIdx;startPos>0;startPos--)
	{
		string c=richTextBox1.Text.Substring(startPos-1,1);
		if(c == " ") // add more seperator check here
			break;
	}
	//get the left part
	word=richTextBox1.Text.Substring(startPos,cIdx-startPos);
	//go right
	for(startPos=cIdx;startPos<richTextBox1.Text.Length;startPos++)
	{
		string c=richTextBox1.Text.Substring(startPos,1);
		if(c == " ")// add more seperator check here
			break;
	}
	word+=richTextBox1.Text.Substring(cIdx,startPos-cIdx);
	return word;
}
private void richTextBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
  	Point p=new Point(e.X,e.Y);
	String word=GetWordFromPos(p);
	Debug.WriteLine(word);
}

If you use TextBox then TextBox didn't have equivalent method or as i know so you need to use SendMessage Windows API to Function to send EM_CHARFROMPOS to get the index of the Char and Modify the previous function to take to get the text for more inf o look at
EM_CHARFROMPOS Message [^]

MCAD

-- modified at 22:30 Tuesday 13th September, 2005
GeneralRe: Grab Text From Other Window Pin
Afief13-Sep-05 19:39
Afief13-Sep-05 19:39 
Questionhow export datagrid to excell Pin
ashish2001mca13-Sep-05 10:48
ashish2001mca13-Sep-05 10:48 
AnswerRe: how export datagrid to excell Pin
Mohamad Al Husseiny13-Sep-05 11:17
Mohamad Al Husseiny13-Sep-05 11:17 
QuestionI want using the method &quot;system(&quot;PAUSE&quot;);&quot; in C#, but I cannot find which namespace it blog to? Pin
shanzy13-Sep-05 10:30
shanzy13-Sep-05 10:30 
AnswerRe: I want using the method &quot;system(&quot;PAUSE&quot;);&quot; in C#, but I cannot find which namespace it blog to? Pin
QuietKnight13-Sep-05 11:11
QuietKnight13-Sep-05 11:11 
GeneralRe: I want using the method &quot;system(&quot;PAUSE&quot;);&quot; in C#, but I cannot find which namespace it blog to? Pin
shanzy13-Sep-05 19:02
shanzy13-Sep-05 19:02 
AnswerRe: I want using the method &quot;system(&quot;PAUSE&quot;);&quot; in C#, but I cannot find which namespace it blog to? Pin
Luis Alonso Ramos13-Sep-05 14:09
Luis Alonso Ramos13-Sep-05 14:09 
GeneralRe: I want using the method &quot;system(&quot;PAUSE&quot;);&quot; in C#, but I cannot find which namespace it blog to? Pin
shanzy13-Sep-05 19:27
shanzy13-Sep-05 19:27 
AnswerRe: I want using the method &quot;system(&quot;PAUSE&quot;);&quot; in C#, but I cannot find which namespace it blog to? Pin
Daniel Turini13-Sep-05 21:08
Daniel Turini13-Sep-05 21:08 
GeneralRe: I want using the method &quot;system(&quot;PAUSE&quot;);&quot; in C#, but I cannot find which namespace it blog to? Pin
shanzy13-Sep-05 21:37
shanzy13-Sep-05 21:37 
QuestionRegex find Date in HTML Response String Pin
surfman1913-Sep-05 10:21
surfman1913-Sep-05 10:21 
AnswerRe: Regex find Date in HTML Response String Pin
User 665813-Sep-05 12:34
User 665813-Sep-05 12:34 
GeneralRe: Regex find Date in HTML Response String Pin
surfman1913-Sep-05 13:02
surfman1913-Sep-05 13:02 
GeneralRe: Regex find Date in HTML Response String Pin
surfman1913-Sep-05 13:30
surfman1913-Sep-05 13:30 
GeneralRe: Regex find Date in HTML Response String Pin
User 665813-Sep-05 13:58
User 665813-Sep-05 13:58 
AnswerRe: Regex find Date in HTML Response String Pin
Guffa13-Sep-05 17:51
Guffa13-Sep-05 17:51 
QuestionRemoting SAO with non-default construction Pin
Asad Hussain13-Sep-05 10:18
Asad Hussain13-Sep-05 10:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.