|
You could subscribe to the SelectionChanged event.
Then, using the SelectionStart property, you can find out where the new selection is and extract the word from there.
Regards,
mav
|
|
|
|
|
when i click on the rich text box, how can i get the character number?
like 7th character from the start?
|
|
|
|
|
The SelectionStart property gives you that. SelectionLength gives the number of characters selected from SelectionStart .
For the reverse, ie. selecting text when a node is clicked, that's easy, you can just call the Find method on the text box and select it.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
thanks for the help.
it works now
|
|
|
|
|
Hello everyone!
I'm designing datetime textbox by C# & ASP.NET, I want data type is datetime but users access in my website enter datetime such as mm/yyyy.
How can I do?
Please tell me!
Thank you!
|
|
|
|
|
You can simply parse the TextBox into a DateTime. If the entered Date is of a recognized format, this will automatically convert the string into a DateTime.
e.g.:
DateTime myDate = DateTime.Parse(textBox1.Text);
If you want to force the users to use a certain format, check the textbox for the compliance before you parse it. Show some error-message if it does not.
Cheers
Sid
|
|
|
|
|
how to use char** from C library to C# using invoke.
[C]
int TestFn( char** UserBuffer);
[C#]
[DllImport[("My_C_DLL")]
public static extern int TestFn( ref IntPtr UserBuffer);
[USE in C# CODE]
IntPtr pBuffer = new IntPtr();
TestFn(ref pBuffer);
When I used it like that, I did get NULL values. What are we doing wrong here?
Shail Srivastav
shailsrivastav@hotmail.com
blog
|
|
|
|
|
try this
[DllImport[("My_C_DLL")]
public static extern int TestFn([In, Out] string[] UserBuffer)
it's in MSDN at ms-help://MS.MSDNQTR.2005APR.1033/cpguide/html/cpconarrayssample.htm
|
|
|
|
|
Thank a lot, It works great . Can you please send me the MSDN help link again, I am not able to open the link.
Thanks
Shail
Shail Srivastav
shailsrivastav@hotmail.com
blog
|
|
|
|
|
|
Hi,
I'm using RichTextBox control. My require is to shieding the "select " Function, i.e. preventing from the Function that when I hold the mouse down and move, the segment of the text will be selected.
How to realize this ?
Please help me !
welspring
hope for help
|
|
|
|
|
Hi!
A RichTextBox where you can't select the text (basically a label with formatting) is a by-product of my article here[^]
I guess that's exactly what you want.
Regards,
mav
|
|
|
|
|
HI,
I have seen your implementation of not seleting in RichTextBox. But sorry, I want the richtextbox can get focus yet not selecting. How to do?
welspring
hope for help
|
|
|
|
|
Hi!
What's the point in allowing the RTB to receive focus when the user can't do anything in it?
A label can't receive focus either, so why should a label with formatted text?
mav
|
|
|
|
|
Hi everybody!
I selected from calender, enter textbox after that I want insert SQL Server 2000.
How can I do it?
Please, help me!
Thank you!
study, study and studymor
|
|
|
|
|
insert into table(date) values(dateTimePicker1.value)
try this query in the sqlCommand object.
regards
Rizwan
|
|
|
|
|
Hi, Sir and Madam
Please see my code.
public class TB : DataTable
{
private string _Sample;
public string Sample
{
get{return _Sample;}
set{_Sample = value;}
}
}
private void TestCasting()
{
TB tb1 = new TB();
DataSet ds = new DataSet();
ds.Tables.Add(tb1);
TB tb2 = (TB) ds.Tables[0];
//the line above I cannot get tb2. How to make my code useable
//Thank You. Sorry for bad English.
}
|
|
|
|
|
hey
i cant see any mistakes in your code and i copied it into my vs and it works fine. so i think the mistake must be somewhere else.
|
|
|
|
|
Hello csharpers,
I'm seeking for an option (region) to define a range were my variable definitions are protected against access by the IDE which mixes always control definitions with my own.
Does someone know a solution.
Thank you in advance
fracalifa
|
|
|
|
|
AFAIK, the IDE only modifies whatever is in the "Component Designer generated code" region. Whatever you write elsewhere won't be modified by the IDE.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Don't know why but ...
Variable definitions are placed elsewere only the variables, class, components initializations are placed in that region.
Some ideas to change that ?
fracalifa
|
|
|
|
|
Hi there!
this problem costs me a couple of days and I still haven't had the answer. I use function System.CodeDom.Compiler.CompileAssemblyFromSource() to generate a dll file on disk, just generate, I dont want to use it in my running application at all, but when the dll has generated, I make some ajustment and built it again, it rejects my request with an IOException: the file is begin used by another process.
I look for the generated dll in my running process' process modules and found it!! so what should I do to build my dll again and again.
Help me plz! thanks a lot
|
|
|
|
|
without your answers, I have to look around in the net and still cant find it. Is my question hard to answer or you dont want to answer me? I just want to know in order to find it somewhere else
|
|
|
|
|
I am working on messenger.On each client side there is an interface that listens the new user request and opens a new window for chatting.But when i use to show the application halts i am writing the code if some one know the solution please Let me know.
Thread thread=new Thread(new ThreadStart(reciveConnection));
thread.Start();
Socket sock;
public void reciveConnection()
{
TcpListener tcp=new TcpListener(4600);
tcp.Start();
While(true)
{
sock=tcp.AcceptSocket();
Client cli=new Client();/////Initiating object for new clent window
cli.Show();/////Here problem Accours.
}
}
|
|
|
|
|
should u not declare Socket sock above the thread.Start()?
There is a good chance that the sock=tcp.AcceptSocket() will be called before the socket is actually declared!
|
|
|
|