|
Hi!
I think you need to write something like
richTextBox1.Select(0,1); This will select the first character in richTextBox1 .
What you're doing in your code is to replace the selected text (not the selection!) in your RTB with the first character in the RTB.
If you want to highlight the first character of a given string in your RTB, you'd write something like this:
int idx = richTextBox1.Text.IndexOf(theStringToSearch);
if (idx >= 0)
richTextBox1.Select(idx,1); Regards,
mav
|
|
|
|
|
how can open internet Explorer with www.mywebsite.com
in my Windows Applction
Palestine
|
|
|
|
|
look at the System.Diagnostics.Process IE will open the first command line parameter it recieves.
|
|
|
|
|
this is the code:
<br />
Process.Start("www.website.com");<br />
See you
|
|
|
|
|
Hello,
I am using the help class for my help files, and the folder Help where all my help files are located are in my application folder.
<br />
Help.ShowHelp (this, "Help\\Economic Assessment Solution Help.chm");<br />
However, this statement does not work, the app does not display the help option. But if I provide the full pathname it does. I want to deploy the application on other machine, so the full pathname is not an option. Any ideas on what is the best way to do it?
Thank you
|
|
|
|
|
The current directory changes if you use the Open/Save dialogs, so I'd suggest using the Application.StartupPath[^] property instead.
Help.ShowHelp(Path.Combine(Application.StartupPath, "YourFileName"));
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
hi im doing a windows application in VS.net 2005 (C#) almost finished,i have an Edit menu
and i have many controls that are loaded as the user context
changes and any of them may contain editable controls,how do i track the state of
all these controls, update the my edit menus( enabled and disable some menu items)
if you could refer me to Articles or working examples id really appreciate it
thanks
regards paula
|
|
|
|
|
I don't know if this is the best way, but you can try using the Application.Idle[^] event to enable/disable your menu items. That event is fired when there are no more messages to be processed by your application. All you need to do is subscribe to the event and in the event handler, check the state of the various user controls and enable/disable the menu items.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Someboby have the Print Version "Professional C# 2005". send me it to rjorget@yahoo.es
Please
help me.
Mi nombre es Renier Jorge Telles
Soy estudiantes de informatica y estoy interaso en compartir con ustedes conocimientos y dudas de esta rama.
|
|
|
|
|
|
is there any way to override it's using the default browser for displaying an html file?
|
|
|
|
|
ArrayList a1 = new ArrayList();<br />
<br />
Cube c = new Cube();<br />
c.Value = 1;<br />
a1.Add(c);<br />
<br />
<br />
ArrayList a2 = (ArrayList)a1.Clone();<br />
<br />
Cube ctemp = (Cube)a2[0];<br />
<br />
ctemp.Value = 20;
If I make the clone of a1, all references will be unchanged. So if I take the cubeobject out of a2 and change its value, the value in a1 is also changed. How can I make a copy of Cube?
|
|
|
|
|
You need to deep copy (clone) the Cube objects themselves. Implement ICloneable on Cube, iterate and call Clone on each of the cube objects.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I never has working in c# and i do not how is the used of reference.
Mi nombre es Renier Jorge Telles
Soy estudiantes de informatica y estoy interaso en compartir con ustedes conocimientos y dudas de esta rama.
|
|
|
|
|
In C#, all class es are reference types. They are different from C++ references, in fact, you can consider them as pointers. For example
class A
{
public int x;
}
static void Main()
{
A a = new A();
a.x = 10;
A b = a;
Console.WriteLine(b.x);
b.x = 20;
Console.WriteLine(a.x);
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Here is some information about pointers in C#. A class is a reference type, and as such, it is always allocated on the heap, with a pointer to it on the stack. A struct us a value type, and as such, it is always allocated directly on the stack. You can force something to be passed by reference using the 'ref' modifier in a parameter. For classes, this will pass the original pointer. This contrasts with the normal method, which passes a copy of the original pointer. For structs, using ref will create a pointer to the struct data on the stack. This contrasts with the normal method, which passes a copy of the whole struct.
class MyClass
{
public MyClass(int number)
{
Number = number;
}
public int Number;
public override string ToString()
{
return Number.ToString();
}
}
struct MyStruct
{
public MyStruct(int number)
{
Number = number;
}
public int Number;
public override string ToString()
{
return Number.ToString();
}
}
public class Program
{
public static void Main()
{
MyClass myClass = new MyClass(10);
MyStruct myStruct = new MyStruct(5);
Console.WriteLine("Original Values:");
Console.WriteLine(myClass);
Console.WriteLine(myStruct);
TestNorm(myClass, myStruct);
Console.WriteLine("After first test:");
Console.WriteLine(myClass);
Console.WriteLine(myStruct);
TestRef(myClass, myStruct);
Console.WriteLine("After second test:");
if (myClass == null)
Console.WriteLine("myClass is null);
else
Console.WriteLine(myClass);
Console.WriteLine(myStruct);
}
// This function gets a copy of the pointer to myClass
// And gets a copy of the whole myStruct struct
// Modifying myClass modifies the same actual data in memory
// as the Main() function modifies.
// Modifying myStruct modifies only the local copy.
public static void TestNorm(MyClass myClass, MyStruct myStruct)
{
myClass.Number = 20;
myStruct.Number = 10;
Console.WriteLine("First Test:");
Console.WriteLine(myClass);
Console.WriteLine(myStruct);
myClass = null;
}
// This function gets the original pointer to myClass
// And gets a pointer to the original myStruct data on the stack
// Modifying myClass modifies the same actual data in memory
// as the Main() function modifies.
// Modifying myStruct modifies the original data on the stack.
public static void TestRef(ref MyClass myClass, ref MyStruct myStruct)
{
myClass.Number = 35;
myStruct.Number = 15;
Console.WriteLine("Second Test:");
Console.WriteLine(myClass);
Console.WriteLine(myStruct);
myClass = null;
}
}
The output of this program will be:
Original Values:
10
5
First Test:
20
10
After first test:
20
5
Second Test:
35
15
After second test:
myClass is null
15
-- modified at 13:54 Tuesday 8th November, 2005
|
|
|
|
|
Hello!
I have a problem in Visual Studio .NET 2003 IDE.
Actually I am creating a User Control named 'MyDateBox' by inheriting
"Microsoft Masked Edit Control" (COM component)
Visual Studio displays the property of this control without any message when I create an instance of this control on a Form If i don't add any property to this control.
But when I add any property to this control (i.e. DateSeparator as string), and draw an instance on any Form. Visual Studio displays the following error in the MessageBox when I call the property window for this control.
"An Exception has occured while painting the label for property 'DateSeparator'. See below for details"
I hope somebody has the solution
Please help!
|
|
|
|
|
Gulfraz Khan wrote: "An Exception has occured while painting the label for property 'DateSeparator'. See below for details"
I hope somebody has the solution
someone might, but without the details we don't have any idea what you're doing wrong.
|
|
|
|
|
Hi!
I think I have stated my problem in detail. but for your reference let me state it again.
I am trying to create a custom control by inheriting the Masked Edit Control.
All is well when I do not add any property to this control's class.
But when I add any read/write property (i.e. MinDate) Visual Studio does not display the properties window of my custom control when I use this control in any project (property window does not display MinDate property and the value and label for this property becomes black in the property window.
Is their something wrong with inheriting a COM control (which I am trying to Inherit for my User control)?
I hope you understand my problem this time.
Thank You
|
|
|
|
|
You've stated what you're trying to do but not the details of the error. IN the error dialog you need to copy out the details it lists below and post them here.
|
|
|
|
|
Hi dan!
I am sorry I forgot to mention that the message is shown in a typical message box and it has no details below this message.
|
|
|
|
|
Hallo!
has someone tried the minihttpd?
I did and it working fine sofar from my PocketLOOX.
But is I tried to download from a iPAQ it doesn't work?
does soneone have any sugestion for me?
thanks you
sayangoin
|
|
|
|
|
Hi!
You should ask this question in the comments section of the article itself, the generic C# forum isn't the right place.
Regards,
mav
|
|
|
|
|
ok got a similar problem to earlier post but im trying to get images
this is what ive got
if (contentType.StartsWith("image/"))
{
byte[] imageBuffer = new byte[reader.BaseStream.Length];
reader.BaseStream.Read(imageBuffer, 0, (int)reader.BaseStream.Length);
Debug.WriteLine("Sending " + contentType + " back to client");
this.m_socket.Send(imageBuffer);
}
but this is not good beacause the underlying stream doesnt support this operation.
the problem i am trying to solve is this. my application is a proxy for browsing http, all is good except when i encounter an image tag like
|
|
|
|
|
What is your "reader" object's type? What is the underlying stream? I highly doubt that the underlying stream doesn't support the Read operation.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|