|
leppie wrote:
Now that I have scared you enough
I'm not scared about this. I know that I can't write a code editor on one day.
You said Sharp Develop! I've got an idea! Is it possible to use components like CodeEditor,Windows Forms Designer from the Sharp Develop components?
Thank you for the information you gave me!
|
|
|
|
|
petermax2 wrote:
You said Sharp Develop! I've got an idea! Is it possible to use components like CodeEditor,Windows Forms Designer from the Sharp Develop components?
Its possible, but I can gaurentee you that you will be pulling your hair out, fixing bugs, and trying to understand someones idea of logic. Also there codeeditor component is a huge memory hog. My control uses a fraction of the memory used by the former. Try loading a big file in it say about 10mb, it will use close to 300mb of memory, where mine "only" use about 70-80mb.
Well if you decide to go for it, good luck!
top secret
|
|
|
|
|
Hello,
Can I install my service manually not using some kind of installutil.exe or install visard. May be I can connect to the SCM and install my service like I can do this under C++?
Regards
Alex
|
|
|
|
|
The ServiceController doesn't support the installation of services. You can use the AssemblyInstaller class, though, to load your assembly and run the installers in it. See the class documentation in the .NET Framework SDK for more information and an example of using it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am receiving ArgumentException: "Must specify value for source." But I specifying correct path to the assembly. What is the problem.
IDictionary mySavedState = new Hashtable();<br />
try<br />
{<br />
string[] commandLineOptions = new string[ 1 ] {"/LogFile=example.log"};<br />
System.Configuration.Install.AssemblyInstaller myAssemblyInstaller = new <br />
System.Configuration.Install.AssemblyInstaller( Application.ExecutablePath , commandLineOptions );<br />
myAssemblyInstaller.UseNewContext = true;<br />
myAssemblyInstaller.Install( mySavedState );<br />
myAssemblyInstaller.Commit( mySavedState );<br />
}<br />
catch (ArgumentException e)<br />
{<br />
string s = e.Message;<br />
}<br />
catch (Exception e)<br />
{<br />
Console.WriteLine( e.Message );<br />
}<br />
This code calling from service project to install itself
|
|
|
|
|
I threw together a simple example using the following code and it worked fine:
static void Main(string[] args)
{
if (args.Length > 0)
{
string[] rest = new string[args.Length - 1];
if (rest.Length > 0) args.CopyTo(rest, 1);
if (string.Compare(args[0], "/install", true) == 0)
{
Install(rest);
return;
}
else if (string.Compare(args[0], "/uninstall", true) == 0)
{
Uninstall(rest);
return;
}
}
ServiceBase.Run(new Service1());
}
static void Install(string[] args)
{
AssemblyInstaller installer = new AssemblyInstaller(
typeof(Service1).Assembly.Location, args);
IDictionary state = new Hashtable();
try
{
installer.UseNewContext = true;
installer.Install(state);
installer.Commit(state);
}
catch (Exception e)
{
installer.Rollback(state);
Console.Error.WriteLine(e.Message);
}
}
static void Uninstall(string[] args)
{
AssemblyInstaller installer = new AssemblyInstaller(
typeof(Service1).Assembly.Location, args);
IDictionary state = new Hashtable();
try
{
installer.Uninstall(state);
}
catch (Exception e)
{
Console.Error.WriteLine(e.Message);
}
} While Application.Location should return the correct path, it puts a possibly unnecessary dependency on the System.Windows.Forms.dll assembly. If you don't need to reference that assembly, just use Assembly.Location instead (there's many ways to get the current assembly, I just got it from the Type).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you,
I can see my mistakes now. But I have one more question: the code you write will install assembly as what? I cann't find service in Services applet with DisplayName of my service.
Regards
|
|
|
|
|
Make sure both the ServiceInstaller and ServiceProcessInstaller instances you've configured are added to your own Installer class derivative, which must be attributed with the RunInstallerAttribute with true in the constructor, otherwise the AssemblyInstaller won't know what class(es) are the installers and will do nothing of importance.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey,
I have a problem with C# DATAGRIDs. This is exactly what I am trying to do :
(Suppose)We have got a datagrid with 1 column (named customer, eg.). In the column cells the user is supposed to type customer codes which -let's say- are 8 characters long.
It would be interesting that whenever the user types in 8 characters in a cell that the corresponding customer's name will be displayed somewhere on the windows form..
Obviously, we need to define and use SOME EventHandler..
I tried to use a DataGridTableStyle with one DataGridTextBoxColumn, then I added this :
<code>DataGridTextBoxColumn nameColumnStyle = new DataGridTextBoxColumn();
...
nameColumnStyle.TextBox.TextChanged += new System.EventHandler(textBox_TextChanged);</code>
But it seems not to work!!
Even when I use this :
<code>...
nameColumnStyle.TextBox.Leave += new System.EventHandler(textBox_Leave);
...,</code>
the method textBox_Leave(..) is executed only once I click with the mouse on another cell, but never when I leave the cell using the left or down arrow for example!?
<b>I really need your help PLEASE!</b>
|
|
|
|
|
benq wrote:
I tried to use a DataGridTableStyle with one DataGridTextBoxColumn, then I added this :
DataGridTextBoxColumn nameColumnStyle = new DataGridTextBoxColumn();
...
nameColumnStyle.TextBox.TextChanged += new System.EventHandler(textBox_TextChanged);
But it seems not to work!!
You didn't mention what didn't work, but this works fine for me:
private void TextBox_TextChanged(object sender, EventArgs e)
{
TextBox tBox = (TextBox)sender;
if(tBox.Text.Length == 8)
Console.WriteLine(tBox.Text);
}
Charlie
if(!curlies){ return; }
|
|
|
|
|
TextChanged is fired AFTER (hence the past-tense "Changed") the text is commited, not while it's being typed.
Handle the KeyDown event. Verify the length and cancel the event (set KeyEventArgs.Handled to true ) if necessary.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i want to know how to get running application in windows xp through c# application, i thought that GINA.dll will help me but it didnt work
|
|
|
|
|
u must install dot net framwork in the xp windows installing component
|
|
|
|
|
amal_pro83 wrote:
how to get running application in windows xp through c# application, i thought that GINA.dll will help me but it didnt work
Where do you get that idea from? GINA is for user identification and authentication. That screen where NT/2000 said "Press Ctrl-Alt-Delete to logon" ... that's GINA...
Getting the Process list is easy. Look into "System.Process" class, here[^]. You'll need to import the System.Diagnostics namespace to use it.
RageInTheMachine9532
|
|
|
|
|
i got idea, from task manager u get from GINA got me , okay....i want to get opened applications..i know code of Process but i dont want all running exe on computer as most of them are services..i just want only applications running...breifly, all appear in taskbar as opened..got it
|
|
|
|
|
The Task Manager isn't part of GINA. But, it can be launched by it...
You'd have tp do some detective work to fish out the services from the applications. All a service is is a windowless application that runs in the background under a different user and desktop.
RageInTheMachine9532
|
|
|
|
|
thanks i did it
public static string[] Detect_Run_App()
{
int j=0;
Process[] processes=Process.GetProcesses();
for(int i=0; i
|
|
|
|
|
Told ya!
All it takes is a little research...
RageInTheMachine9532
|
|
|
|
|
Hi,
How to pass null to a ref bool or out bool parameter?
Thanks.
|
|
|
|
|
bool is a value type, therefore it cannot be null. bool is either true or false. There is no other state.
By the way, when using out , the variable must be assigned a value before the method returns. The value of your variable going in wouldn't matter because it will be assigned a value before you get it back. Passing null (even if you could) wouldn't have any affect.
Charlie
if(!curlies){ return; }
|
|
|
|
|
There is some sourceForge project available that does implement just that. Nullable Value types.
http://nullabletypes.sourceforge.net/
I wouldn't recommend it (if it's supposed to be a boolean, check for a boolean)
|
|
|
|
|
FYI .NET 1.2, set to be beta'd this year and released next year, will utilize 1.2 generics feature for a Nullable value type, defined as Nullable<T>. This would allow you to pass a null value into a value parameter. See here[^] for more info.
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
It will be .NET 2.0, not 1.2. The file versions are only labeled as 1.2, just like the file versions for 1.1 are 1.1 but the assembly versions are still 1.0.5500.0. ".NET 2.0" is mentioned in many places on Microsoft et. al. sites.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Oh really? I didn't know that; I knew C# would be C# 2.0, but I was under the impression it was .NET 1.2.
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
Here's one current reference: http://msdn.microsoft.com/vstudio/productinfo/roadmap.aspx#2005[^].
I believed they used ".NET 1.2" for a while but that started changing a few months ago.
[EDIT] Oh, and rightly so. A LOT (as I'm sure you know) is changing between 1.1 and 2.0, unlikes the few changes between 1.0 and 1.1. It's still mostly backward compatible, but it includes a lot of bug fixes, performance enhancements, control adapters (new way to provide owner-drawing that's truly aweseom!), many new ASP.NET enhancements including some for WSS/SPS, and - of course - generics.
[/EDIT]
Microsoft MVP, Visual C#
My Articles
|
|
|
|