|
Try counting the newlines (ie "\r\n")?
I think that should work...
Later,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
|
Nishant S wrote:
But till where do I count them? I have to know where the current pointer is right?
Use the selectionstart property.
----------------
Quote from MSDN:
Gets or sets the starting point of text selected in the text box.
[C#]
public int SelectionStart {get; set;}
.
.
.
Remarks
If no text is selected in the control, this property indicates the insertion point for new text. If you set this property to a location beyond the length of the text in the control, the selection start position will be placed after the last character. When text is selected in the text box control, changing this property may decrease the value of the SelectionLength property. If the remaining text in the control after the position indicated by the SelectionStart property is less than the value of the SelectionLength property, the value of the SelectionLength property is automatically decreased. The value of the SelectionStart property never causes an increase in the SelectionLength property.
Note You can programmatically move the caret within the text box by setting the SelectionStart to the position within the text box where you want the caret to move to and set the SelectionLength property to a value of zero (0). The text box must have focus in order for the caret to be moved.
--------
The SelectionStart property should return the current position in the RichEditBox.
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
I have a class derived from the System.Windows.Forms.TextBox .
I have overridden TextBoxBase.OnModifiedChanged but it never gets called even when I change the text in the text control
Has anyone else experienced the same problem?
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
|
Hi,
I was not able to find the option for PostBuild Action in the C# Project Properties.
(Where I can Specify some Dos commands to run after the project is Compiled)
Is there any alternative feature avaliable?
Thanks,
FiroZ
|
|
|
|
|
FiroZ wrote:
Is there any alternative feature avaliable?
You can add an empty Visual C++ project and then do post builds from that project. Just make sure that the empty C++ project is built last in the solution.
Later,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
MSDN has a BuildRules visual studio addin. It lets you add pre and post build commands to solutions and projects.
can't find the link right now... but i know it's on there somewhere
|
|
|
|
|
|
|
|
Some example code would be nice Cant seem to work it into a form, seems a bit messed up
And why does people write controls without default constructors?
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Card[] crds = new Card[3];
crds[0] = Card.New("My Text", 0);
crds[0].Font = new Font("Times New Roman", 10, FontStyle.Bold);
crds[1] = Card.New("My Text", 1, CardShape.Circle);
crds[1].Shadow = false;
crds[2] = Card.New("Solid Colours", 1);
crds[2].CardUp = Color.SkyBlue;
crds[2].CardOver = Color.SteelBlue;
crds[2].CardDown = Color.Navy;
CardCtrl crd = new CardCtrl(crds);
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
leppie wrote:
And why does people write controls without default constructors?
Because they don't have VS.NET or they use MC++ to test it so they don't realize how important the default constructor is to the forms designer
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
|
You do use it, but you defer the setting of the various properties until a little bit later.
The "proper" way to create the control is to expose a Cards property which is a Collection of Card objects. The collection can then be modified at runtime and the control will update itself automatically.
An example of this set up is the ListView control; it exposes an Items collection which contains ListViewItems that represent the items in the control. This collection can be modified at runtime, or code can be output by the forms designer to add the items during the form's InitializeComponent() method.
At first this does not makes sense, but then there are added benefits to coding this way: The control is more flexible in that Cards can be added and removed at runtime; and it opens itself to be easier to use because it follows the standard set by the base controls.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
I see what your saying, but the Cards array in the CardCtrl class needs to be sized correctly. So to add/remove cards at runtime, ive added an Add() and Remove() method.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Is there any way to figure out that specified assembly is loaded or not. What I am trying to do is I want to check if the assembly is already loaded or not. If not then load it if yes then use it from memory. I don't want to load the assembly all the time so just a check.
Thanks
|
|
|
|
|
|
How reliable and sturdy are the above classes?
Are they good enough to write a small server with upto 50 connections that will be passing a 40 character string to client machines over a LAN?
Any useful reading material for these and the base Socket classes? (beyond MSDN)
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
|
How can I write a user defined struct (like the following struct) in binary form to a file?
<br />
[StructLayout(LayoutKind.Sequential)] <br />
public struct BITMAPFILEHEADER <br />
{<br />
public ushort bfType; <br />
public uint bfSize; <br />
public ushort bfReserved1; <br />
public ushort bfReserved2; <br />
public uint bfOffBits; <br />
}<br />
And how can I write the data of a memory block (the only thing I have is the the "IntPtr") in binary form to a file?
IntPtr p --> file
Thanks, Daniel.
|
|
|
|
|
you can use the BinaryFormatter class to serialize an object to a Stream.
This may or may not fit your needs.
|
|
|
|
|
using System.IO;
...
BITMAPFILEHEADER info = new BITMAPFILEHEADER();
info.bla = bla;
...
BinarySerializer bs = new BinarySerializer(typeof(BITMAPFILEHEADER));
Stream mystream = File.Create("SomeFile.ext");
bs.Serialize(mystream, info);
mystream.Close();
one question, what is the purpose of the attribute on your struct?
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Thank you!
I need the attribut, because the struct is used as a parameter of a interop dll function.
Daniel.
|
|
|
|