|
Hi again
Thanks for the tips so far. I'd actually come across those myself but I want to do a lot of work when the form opens and closes that hide introduces problems for. I'll admit that I can probably work around this with a lot of effort. I was just hoping there might be an elegant solution.
Thanks
MrR_
Nothing is foolproof to the talented fool.
|
|
|
|
|
Hi all,
I'm making a little dictionary program in C# for experimenting purposes. everything is coming along fine except how to select the word that is currently under the mouse when the user presses.
in VB6 it was done through an API as i remember, but i don't recall which, but this shold be a .net framework program, so better without any win32 api
Thanks in advance
|
|
|
|
|
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);
int startPos;
for(startPos=cIdx;startPos>0;startPos--)
{
string c=richTextBox1.Text.Substring(startPos-1,1);
if(c == " ")
break;
}
word=richTextBox1.Text.Substring(startPos,cIdx-startPos);
for(startPos=cIdx;startPos<richTextBox1.Text.Length;startPos++)
{
string c=richTextBox1.Text.Substring(startPos,1);
if(c == " ")
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
|
|
|
|
|
The problem is, I want to use this function on the text in other windows, not in my program. and i can't be sure if it'll be a rich textbox, textbox, label or any other control that will be read.
I read the "EM_CHARFROMPOS Message" but it makes little sense to me. high word, low word... it all doesn't sound the c# level. was that in the C++ time?
|
|
|
|
|
hi all
i need help from all of u. i need tested source code to export data from datageid to excellsheet. hoe i do that
ashish
|
|
|
|
|
|
the problem is:
I want to use the method "system("PAUSE");" in C#, but I cannot find which namespace it blog to?
Can you help me??
shanzy
|
|
|
|
|
Do you maybe want System.Threading.Thread.CurrentThread.Sleep() ?
|
|
|
|
|
Thank you for your answer,but I .....
I just want to know how to use the method "system("PAUSE");" in C#
just like in C/C++:
int main()
{
....
system("PAUSE"); //must using this function
....
}
How do this thing in C# ???
shanzy
|
|
|
|
|
You could also do this:
Console.WriteLine("Press Enter to continue...");
Console.ReadLine(); -- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Thank you for your replay!
I can use the method system() like this:
system("cmd.exe");
but I can't use the method:
Console.ReadLine();
----------------------------
So If I must using the method "system();" , how to do it??
shanzy
|
|
|
|
|
|
Thank you very much, I got it
And thank you all friends
shanzy
|
|
|
|
|
hi, how can i find the date in the HTML Response string?
.....
13.09.2005
......
somth. goes wrong here:
<br />
Regex regex = new Regex(@"^([0-9]{1,2}).([0-9]{1,2}).([0-9]{4,4})$");<br />
Match m = regex.Match(HTMLResponseString);<br />
if(m.Success)<br />
{<br />
MessageBox.Show("found");<br />
}<br />
cu
|
|
|
|
|
what about
(?<Month>\d{1,2})[\./](?<Day>\d{1,2})[\./](?<Year>(?:\d{4}|\d{2}))
regards
-- modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi,
i use:
<br />
Regex regex = new Regex(@"(?<Day>\d{1,2})[\./](?<Month>\d{1,2})[\./](?<Year>(?:\d{4}|\d{2}))");<br />
perfect, where do you know the pattern <month> ?
but i dont want to recognize: 05/19/14 only like that: 13.09.2005
cu
|
|
|
|
|
and how can i recognize a date like:
13 Sep 2005
or
14 Okt 2006
or
07 Nov 2005
what about:
<br />
"(?\d{1,2})[\ /](?\w{3})[\ /](?(?:\d{4}|\d{2}))"<br />
cu
|
|
|
|
|
That would work:
(\d{2})\s(\w{3})\s(\d{4})
modified 12-Sep-18 21:01pm.
|
|
|
|
|
You are specifying the start of the string (^) and the end of the string ($) in the pattern. If you remove these, you will find the date.
---
b { font-weight: normal; }
|
|
|
|
|
I need to create a .NET remoting SAO with a non-default constructor i.e. a constructor with parameters. Is this possible? and if so, how?
|
|
|
|
|
You can not use non default constructor with SAO you have to use default constructor if you need to use non default constructor use CAO instead
MCAD
|
|
|
|
|
How do you count the number of controls on a C# form. I mean suppose i have 3 textboxes on the form, i want my countr to return '3'.
|
|
|
|
|
Depends on how the controls are arranged in the form. If all are jst plain on the form form.Controls.Count should do what you want. If some controls sit within other controls (like panels, groupboxes etc) you will have to count recursively:
private int CountControls(Control control){
int result = 0;
foreach (Control subControl in control.Controls){
result++;
result += CountControls(subControl);
}
return result;
}
|
|
|
|
|
|
We need to implement better security into a C# Windows Desktop Application we are building, and are hoping to get best practices recommendations on the following:
1) "encrypted username / passwords" for connection strings -- actually any technique that will hide the connection string specifics from the user once, the application is built and put into an executable -- possibly by using the Registry.
2) Use of XML for pooling connection strings and the storing of username / passwords in the XML string: building a connection string based on settings in an XML File -- in some encrypted form... see 1) above...
3) NT Authentication for user login.
Thanks for any information you can give us.
Anne
|
|
|
|