|
i have a windows service which need to be control by a windows apllication i.e the system tray. in the installer class of windows service i had a code that starts the system tray process and it works fine until when i restart my computer after restarting my computer the windows service as it should be starts automatcilly but not the system tray
apllication.
then for this i added a thread onstart method of windos service . but it seems the system tray application only starts on the background. it does not go where it should go. does any one have any idea.
here is my code plz do not complain abt the path.myproc is instace of class process!!!plz do help . nye the way it works well on windows application.
protected override void OnStart(string[] args)
{
this._applicationLaunchThread= new Thread(new ThreadStart(myproc.StartProcess));
this._applicationLaunchThread.Start();
}
public class Process
{
public Process()
{
//
// TODO: Add constructor logic here
//
}
bool _isnotexist;
public void StartProcess()
{
if(CheckProcess())
{
MyTimerSrv my= new MyTimerSrv();
try
{
System.Diagnostics.Process.Start(@"C:\Program Files\servicetracerclient\WindowsApplication1");
// my.AddToError(" application launch reached");
Thread.CurrentThread.Abort();
}
catch(Exception Ex)
{
MyTimerSrv myt= new MyTimerSrv();
myt.AddToError("application launching error");
myt.AddToError(Ex.Message.ToString());
}
}
}
public bool CheckProcess()
{
MyTimerSrv my= new MyTimerSrv();
try
{
System.Diagnostics.Process[] processes;
processes = System.Diagnostics.Process.GetProcesses();
foreach (System.Diagnostics.Process instance in processes)
{
if(instance.ProcessName.ToString()=="WindowsApplication1")
{
_isnotexist=false;
break;
}
else
{
_isnotexist=true;
}
}
}
catch(Exception ex)
{
my.AddToError("exception of process");
my.AddToError(ex.Message.ToString());
}
return(_isnotexist);
}//end of method
}
|
|
|
|
|
If you just want to start your service automatically, just go to Control Panel -> Administrative Tools -> Services -> Select your service, click on Properties, then set to "Automatic". It will be started everytime your windows start.
|
|
|
|
|
Hi,
Anybody have idea about how to save visual component created in c# into a
file as an image(any type)? Please let me know the solution............
By,
Shivaprasad
|
|
|
|
|
|
oh........its good one. But it's not the solution for my problem. I created one visual component in c# and i can use it on windows form. But i want to provide one public interface to save that component only in any file as an image. So could anybody help me in this regard.
Waiting for your help............
Shivaprasad
|
|
|
|
|
hi
i want to use dataRow for insert,update and delete records on Client/server dataBase.
my question is can i use dataRows instead of Sql Transactions ?
for Example :
DataRow newRow = this.dataset1.tables[0].NewRow();
newRow["name"] = this.textbox1.text;
this.dataset1.tables[0].rows.Add(newRow)
adapter1.Update(this.dataset1);
(because when i use dataRows Instead of SqlCommands, visual Studio needs a valid Insert,Update or Delete Commands) and i think that i can use DataRows Instead of
SqlTransctions,what is your Advice ?
thanks
-- modified at 7:08 Wednesday 13th December, 2006
|
|
|
|
|
Considering a DataRow and a Transaction are completely different things, I cant understand what you are asking.
DataRow - represents a row within a DataTable and stores values for each column within that table
Transaction - A way of executing multiple queries against a database and either commiting all changes or rolling back all changes.
|
|
|
|
|
hi J4amieC
Please see My Example that show how to use DataRows for Insert,Update and delete
(in my example 'Insert')
|
|
|
|
|
Please see my description of the difference between a DataRow and a Transaction - they are unrelated in the context of what you are doing.
You are using a DataAdapter which must have a valid Insert/Update/Delete command according to what you are trying to do. In your example code you have not assigned ANY commands to the adapter so I cant tell what you are doing.
Please also remember to post the text of any exceptions you are receiving as it will help solve your problem.
|
|
|
|
|
You have the right idea you are just implementing it wrong.
Look at this code:
case "Microsoft.Jet.OLEDB.4.0":
OleDbConnection OleConn = new OleDbConnection(_ConnString);
OleDbDataAdapter OleAdp = new OleDbDataAdapter(InsertString, OleConn);
OleAdp.InsertCommand = new OleDbCommand(SQL.BuildHourlySQL());
OleAdp.InsertCommand.Parameters.Add("@RecID", OleDbType.Integer, 50, "RecID");
OleAdp.InsertCommand.Parameters.Add("@DSID", OleDbType.Integer, 50, "DSID");
OleAdp.InsertCommand.Parameters.Add("@Month", OleDbType.Integer, 50, "Month");
OleAdp.InsertCommand.Parameters.Add("@Day", OleDbType.Integer, 50, "Day");
OleAdp.InsertCommand.Parameters.Add("@Year", OleDbType.Integer, 50, "Year");
OleAdp.InsertCommand.Parameters.Add("@Hour", OleDbType.Integer, 50, "Hour");
OleAdp.InsertCommand.Parameters.Add("@KW", OleDbType.VarChar, 50, "KW");
OleAdp.InsertCommand.Parameters.Add("@KVAR", OleDbType.VarChar, 50, "KVAR");
OleAdp.InsertCommand.Parameters.Add("@CAP", OleDbType.VarChar, 50, "CAP");
OleAdp.InsertCommand.Connection = OleConn;
OleConn.Open();
OleAdp.Update(_HourlyData);
didUp = true;
OleConn.Close();
return _HourlyData;
break;
In a differnt part of your code this is where you use the Datarow:
DataRow _dr = _HourlyData.NewRow();
_dr["RecID"] = _RTm.RecID;
_dr["DSID"] = _RTm.DataSetID;
_dr["Month"] = _RTm.Month;
_dr["Day"] = _RTm.Day;
_dr["Year"] = _RTm.Year;
_dr["Hour"] = _RTm.Hour;
_dr["KW"] = _HrData.RA_Tot;
_dr["KVAR"] = _HrData.RB_Tot;
_dr["CAP"] = _HrData.RC_Tot;
_HourlyData.Rows.Add(_dr);
Programmer: A biological machine designed to convert caffeine into code. * Developer: A person who develops working systems by writing and using software.
[ ^]
|
|
|
|
|
how to run an *.exe from windows Service. i use System.Digonistics.Process.Start("WindowApp.exe");
the windowApp.exe runs in Window Task Manager in Applcation tab. but do not show in desktop, please help me.
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wli
|
|
|
|
|
Sanjib Raj wrote: the windowApp.exe runs in Window Task Manager in Applcation tab. but do not show in desktop
Windows Services run without a user interface, they start outside the scope of a user session. If you run an application through the service its interface is probably hidden by default. How could it know where to display its interface anyway? There could be no user logged in, there could be multiple users logged in....
|
|
|
|
|
Hi,
I'm starting a new windows forms application in VS2005. The main apparence of the application should be a dialog with a splitContainer where I'd like to fill with a side menu and then, depending on the option selected change the content of the central panel.
how can I load and unload a whole dialog/form in the central panel depending on the option selected?
thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
you can use the user controls and place it inside the central panel
you should define a user control for each button or action that comes from the left or menu panel.
good luck
|
|
|
|
|
Great thanks, but how to load or unload each user control depending on the option selected?
Thansk again,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
|
How to save textbox in table sqlserver2000
روی فرم چطوری میتوانم اطلاعات داخل جعبه متن را با فشار دادن دکمه ذخیره در
اس کیو ال ذخیره کرد
|
|
|
|
|
With a stored procedure that does an insert or update. Don't use inline code to achieve this effect.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello All,
I have problem, That is :
In my project I want to popup window from C# function in ASP.net2 and I want it as modal, so I use javascript function window.open() , But I haven't found how can i call this function from general c# function without using event's of button.
Can any help me, Please.
Ala Qunaibi
|
|
|
|
|
Hello,
You can try to use this:
ClientScript.RegisterClientScriptBlock(ClientScript.GetType(), "Focus", "" + "window.open('ImprimirGSA.aspx','frmImprimirGSA','width=650,height=500');" +
"");
The first parameter is the type, the second is a key to identify it and the thirst is the script.
|
|
|
|
|
Thanks.
|
|
|
|
|
i have declared a public propery like below in form1
public partial class Form1 : Form
{
string st;
public string s
{
get
{
return st;
}
}
private void Form1_Load(object sender, EventArgs e)
{
st = "MY PROPERTY";
}
}
and i tried to display this value in form2
using the statements
Form1 f = new Form1();
MessageBox.Show(f.s);
its not giving any errors but displaying nothing in messagebox
but if i initialize the st at the declatation instead of form1_load its displaying correct value
ex: public string st="MT PROPERTY";
please tell me why thats happening and how can i resolve this.
|
|
|
|
|
instead of initializing st in Form_Load ,initialize it in the constructor.
"Change is the only constant thing in life
Either or survive or get extinct"
|
|
|
|
|
but if i need to assign that value after occurrance of some event then how could i get the content?
|
|
|
|
|
If you want to access a value that is present in the current instance of the form, you need a reference to that instance. If you create a new instance of the form, you will always get the same value, as it's a newly created and unused form.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|