|
This puzzled me for a while too. I searched high and low in the .NET Framework SDK and figured you just couldn't do it. Then by chance I ran across it when going individually through each assembly.
It's in a really obvious location. (read with a sarcastic attitude)
System.Diagnostics.Process.Start("notepad.exe");
Cheers,
-Erik
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My thoughts are my own and reflect on no other.
|
|
|
|
|
Hello All,
Anyone knows how to connect to proxy servers? there is a method for web requests, but not for the plain socket component. I have seen samples in C++, but none yet in C#
fadi
|
|
|
|
|
How can I make dockable windows like tool windows in Visual Studio with C# ?
|
|
|
|
|
I've been trying to figure that out myself. I found this article
http://codeproject.com/csharp/dockingcontrol.asp
which demonstrates a docking control, not a standalone window though.
|
|
|
|
|
www.icsharpcode.net has released the code for their C# editor which has that functionality. It is however built around te .Net SDK and even though they ported a version to VS.Net, it is still in same coding style as that of the SDK (no visual forms all code)
It does implement the same docking and tabs look and feel as that of .Net... hopefully someone can extract that functionality and make a standalone sample out of it. It is too advanced for me right now.
fadi
|
|
|
|
|
Can someone point me to some code for a C# grid control? Is it possible to use the datagrid for displaying an editable grid which is not loaded from a database?
Why hasn't Microsoft included a grid control in VS.NET?
|
|
|
|
|
C# ?
Why are you using that? It only encourages Microsoft.
(I don't want to live in a Microsoft world - so only use their stuff when you HAVE to - otherwise it reinforces their monopolies.)
|
|
|
|
|
I thought that there was a c# grid control on here, perhaps a false memory.
|
|
|
|
|
Is there something in C# (maybe working with a 'string' variable) that allows formating like we use in C++ with the sprintf() function or the CString class's member function Format()?
Rick Crone
|
|
|
|
|
Use String.Concat
using System;
class nish
{
public static void Main()
{
string s;
int a=10;
int b=17;
s=String.Concat(a," ",b);
Console.WriteLine(s);
}
}
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
|
VS.NET bug: In Visual Studio, if you have one Form which has its WindowState property set to "Maximized", and you then derive a second Form from that first one, the derived Form does not correctly inherit the WindowState from its parent. It will often end up with a WindowState of "Normal".
The same may be true of the "Minimized" state; I haven't tried it.
Repro steps:
1. Create new project: C#, type "Windows Application", any name.
2. Form1 is now open. In the Properties pane, set WindowState to "Maximized".
3. Build and run the program. The window is maximized, as it should be.
4. Select "Project > Add Windows Form..." from the menus. In the right pane (Templates), select "Inherited Form." Leave the name as "Form2.cs". Click Open. When the "Inheritance Picker" dialog comes up, select "Form1" as the base class.
5. Notice that over in the Properties pane, the WindowState for Form1 is "Normal", not "Maximized"! Oops.
6. Open Form1.cs, and in the Main() function, change "new Form1()" to read "new Form2()", so that Form2 is the one that will be launched by the program.
7. Run the program. Despite the fact that the Properties pane said "Normal", the program is in fact maximized. Oops.
8. Open Form2 in the Designer. Drop a button on it. Doing this will force Visual Studio to re-generate the Form2.InitializeComponent() function.
9. Run the program again. Now, notice that it is NOT maximized! Oops.
You'll find that you can manually change WindowState back to "Maximized", but then, from time to time (I think mainly when you reload the project), Visual Studio will switch it back to Normal.
Mike Morearty
mike@morearty.com
http://www.morearty.com
|
|
|
|
|
Hi folks,
I recently stumbled about an annoying problem while designing components:
It just seems impossible to me to create a control that allows other controls to be put upon at designtime.
As far as I understood the MSDN every control derived from UserControl has the ability to support child controls. That works ok when adding controls simply by code but I can't add them using the designer.
I tried to set AllowDrop to true and played around with the DragDrop events. The problem is I didn't found a way to extract the control from the DragEventArgs parameter (if it is there at all).
Would be great if anybody could tell me how to create a control that act like the GroupBox for example, including visual component adding.
Thanks in advance,
Matthias
|
|
|
|
|
Replace :
System.Windows.Forms.UserControl
with :
System.Windows.Forms.ContainerControl
|
|
|
|
|
Hello,
How can i get a bit of C# code to launch an external program (for instance notepad) ?
Regards,
Tariq
|
|
|
|
|
System.Diagnostics.Process.Start ("notepad.exe");
Check out the documentation on the System.Diagnostics.Process class for more info...
Andreas Philipson
|
|
|
|
|
Thanks for the information. Appreciate it
But I still have one doubt. That is, how do i pass parameters to the application I am trying to run.
eg . notepad test1.txt
I tried giving it in the file name - but that doesnt work.
I couldnt find any other relevant property to achieve this.
Can you help?
Regards,
Tariq
|
|
|
|
|
using System.Diagnostics;
ProcessStartInfo notepad = new ProcessStartInfo ("notepad.exe", "C:\\SomeFile.txt");
Process.Start (notepad);
Andreas Philipson
|
|
|
|
|
Hi,
Has anyone tried using the Process.GetProcesses(string machinename) overload of the Process class in the System.Diagnostics? I am using VS.NET beta 1. I am badly in need of viewing (just viewing!!!) the processes running on a different machine on the same domain.
Can someone help me please?
Thanks.
|
|
|
|
|
As everyone probably knows, in C# (and probably other .NET languages), you can put comments at the top of any class or function in this format (this example is for a function):
void MyFunction(string thing)
The great thing is that C# will automatically use these comments when doing tooltips for auto-complete. I love that.
Unfortunately, it seems that auto-complete does not correctly deal with < and > characters when they appear in the XML. For example, if the following XML appears above a function:
...then that is exactly how auto-complete will display the description of the function. It should be doing standard "entity" conversion, e.g. converting < to < and > to > and so on. (You can't just put < into the summary itself, because that's not legal in XML. Try it -- you'll get an error message in the auto-complete tooltip.)
For another example of this, try typing "Directory.GetLogicalDrives(" into a C# file, and observe that the tooltip that comes up says:
Retrieves the names of the logical drives on this computer
in the form "<driver letter>:\".
Oops. Microsoft, please fix the tooltip code?
By the way, Visual Studio's utility for creating HTML documentation (Tools menu, "Build Comment Web Pages..." command) DOES correctly deal with < and > in the XML.
Mike Morearty
mike@morearty.com
http://www.morearty.com
|
|
|
|
|
I might have the wrong end of the stick here but I remember back when I first looked into XML that you had to define the "data type" of the XML entity for odd characters and entity-conversion to display properly.
Unfortuanatley I am not near my XML book or VS.NET so I cannot remember how to do it, but if you know what I mean then see if defining that data type will help. Not the best solution but it might work
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Do you Sonork? I do! 100.9903 Stormfront
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
|
|
|
|
|
Hai,
I was testing the following code... But i get an error saying...
"The type or namespace name 'EventLog' does not exist in the class or namespace 'WriteToAnEventLog_csharp'."
Why is this so? What part am I missing? I am not using VS.NET Beta. I am using notepad to type this text and used, csc test.cs to compile the code.
Please help me....
using System;
using System.Diagnostics;
namespace WriteToAnEventLog_csharp
{
///
/// Summary description for Class1.
///
class Class1
{
static void Main(string[] args)
{
string sSource;
string sLog;
string sEvent;
sSource = "dotNET Sample App";
sLog = "Application";
sEvent = "Sample Event";
if (!EventLog.SourceExists(sSource))
EventLog.CreateEventSource(sSource,sLog);
EventLog.WriteEntry(sSource,sEvent);
EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning, 234);
}
}
}
Thanks.
|
|
|
|
|
What command line parameters are you using?
you have to use the /r:System.dll to get it to compile...
try this:
csc /target:winexe /out:eventlog.exe class1.cs /r:system.dll
Andreas Philipson
|
|
|
|
|
the /r:System.dll is done automatically when you say csc class1.cs. Also I tried the second option that you told. No luck. But I got VS.NET beta 1 installed on my machine. I created a c# project, built it and its just ducky.
Thanks anyways.
|
|
|
|
|
i init. the child window in instructor of main window.
but if i specified the parant of child to main window, it will rise a exception.
how to do? and where to load the show function?
The Internet Give a Chance to Learn. I Do!
|
|
|
|