|
remove the /Define:
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
How can I add a button when run time? and if there is a button in the form, how can it added next to it? Could you help me,please?
Thanks in advance.
|
|
|
|
|
drago123 wrote: How can I add a button when run time?
You just create the button and add it to the forms Controls collection.
Button b = new Button();
this.Controls.Add(b);
drago123 wrote: and if there is a button in the form, how can it added next to it? Could you help me,please?
You need to work out the position of the existing button, and position your new button alongside it.
int left = existingButton.Left;
left += existingButton.Width;
left += 20;
int top = existingButton.Top;
Button newButton = new Button();
newButton.Left = left;
newButton.Top = top;
this.Controls.Add(newButton); That help?
Simon
|
|
|
|
|
|
Hi,
I have a grid, that has a column of checkboxes. I also have a button outside the grid, that if clicked should toggle the grid view to show only the rows that have checkboxes checked.
What whould be the best way to achieve that?
Set the grid's datasource to a dataview with the filter set?
Any code samples will be really appreciated.
Thank you very much.
|
|
|
|
|
The easiest way is to assign a name attribute to all of the check boxes in the grid that is the same. You can then get a collection returned in javascript and do the assignment without a postback.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Sorry,
I am talking about a Windows forms grid.
|
|
|
|
|
On the checkbox click event assign the underlying datasource to have the value alternated and then Rebind or Refresh the datagrid.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
I want to know how can I send a text file through a phone line to another computer just like pcAnyWhere?
|
|
|
|
|
modem
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
You need a FoneFileFunnel (tm).
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
what is that?
and how to do it in c#?
any examples?
|
|
|
|
|
jrahma wrote: what is that?
Search the web for it, then you'll see what it is.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Good Afternoon All
I have a Windows Service and its Task is to kill a process. the Service is accepting the name of the Process through a Application.Config file. The Service does not Kill the Process. Here is a code that kills the Process as long as the Process is running
namespace Process_Killer
{
public partial class Process_Killer : ServiceBase
{
public Process_Killer()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
String Process_Kill = ConfigurationSettings.AppSettings.Get("Process");
FindAndKillProcess("Process_Kill");
}
protected override void OnStop()
{
}
public void FindAndKillProcess(String name)
{
Process[] procList = Process.GetProcessesByName(name);
while (procList.Length > 0)
{
procList[0].Kill();
}
}
}
}
What is Wrong ?
What is Wrong ?
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Killing a process using a service sounds a little bit odd/risky.
However, if there's no error, the first thing I would do is to check that procList.Length is at least 1 when you expect to find a process. Writing to a log file would be an easy way since service may not communicate with desktop.
Also surround your code in OnStart method using try block and in catch write any problems to the same log file.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Good Morning Sirs
The Problem was the Variable, it was in Quotes, after that it, worked , but it will kill only one Process. at that moment. i want it to Kills all the Processes with that same name and Sleep for 10 min and wakeup again and kill again. Here is the Changed code
namespace Process_Killer
{
public partial class Process_Killer : ServiceBase
{
String Process_Kill = ConfigurationSettings.AppSettings.Get("Process");
public Process_Killer()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
FindAndKillProcess(Process_Kill);
}
protected override void OnStop()
{
}
public void FindAndKillProcess(String name)
{
Process[] procList = Process.GetProcessesByName(name);
if (procList.Length > 0)
{
procList[0].Kill();
}
}
}
}
Thank you
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Your code makes no sense as a service.
You only attempt to find and kill the process once when the service starts,
then you do nothing except loop endlessly trying to kill the same process
over and over again (and consuming pretty much all the CPU cycles for a processor).
What if there's more than one process of the same name running?
Not returning from OnStart() prevents the service from starting.
If you intend your service to stay running and watch for that process and kill it,
you need to start a thread to do that. You can start the thread in OnStart().
You also need to kill ALL the processes in the procList then reload the procList
to check for new instances. You should also sleep a bit in that loop if you're going to
use a loop like that.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank you for your Answer, How can i Archive that, because that is exactly what i want. can you please refer me to an article or give me an example.
Thank you
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Thank you for your Reply i have Found a Solution .i did it like this
protected override void OnStart(string[] args)
{
String Process_Kill = ConfigurationSettings.AppSettings.Get("Process");
Thread thread = new Thread(new ParameterizedThreadStart(DoWork));
thread.Start(Process_Kill);
}
public void DoWork(object data)
{
string Process_Kill = data.ToString();
while (true)
{
FindAndKillProcess(Process_Kill);
Thread.Sleep(5000);
}
}
public void FindAndKillProcess(String name)
{
Process[] procList = Process.GetProcessesByName(name);
for (int i = procList.Length - 1; i >= 0; i--)
{
procList[i].Kill();
}
}
Thank you
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
That looks much better
Thanks for the update.
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm writing a service that connects to oracle and I can't retrieve any data. I am using the System.Data.OracleClient namespace to do this. Is there some sort of caching that I should know about or something else that can cause this???
|
|
|
|
|
Stephen Lintott wrote: and I can't retrieve any data.
If there is a problem there should be some sort of error being returned, set, reported or something, that indicates what the problem is. Why have you not posted that here?
Stephen Lintott wrote: I'm writing a service that
There are two parts of a Service. One part is the code needed to interact as a Service to the OS. The other part is your project code. Did your project code get developed and tested running under a windows user desktop account before it was added to a Service?
led mike
|
|
|
|
|
Most likely the code isn't executed at all or you're hitting an error and ignoring it (if the service call doesn't fail). Try to gather more info what code is run or any error messages that may indicate the cause. Writing to a log file could be one way if you're unable to debug the service side.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I'm using the DataAdapter.Fill method in my code and thats working only the DataSet that is returned does not contain any data. I can see the data in toad but it doesn't come back using the connection objects. No errors are thrown please help...
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
You should try to get more information about the problem. With the info you supplied, I'm merely guessing.
Check these things:
- if you're using parameters in your query, check their values before execution
- also take the executed sql, place the parameter values to it and use that in toad, just to make sure that query is the same you tested
- after DataAdapter.Fill, write somewhere how many rows was returned to make sure that the dataset is really empty and you are not for example returning a copy of the dataset etc
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|