|
Hi!
I have to write a little program in C#, which I should be able to detect when a new program has been opened.
Does anyone have some sample code or hints where to start in order to detect when a new application has been opened.
Thanks in advance
Werner
|
|
|
|
|
Hi, I'm having a problem with this. I don't know why it could be. I'm trying to access a file in a directory located in the bin/Debug or bin/Release folder of the c#.net 2003 project. I access it like this:
string file = "Folder1\\Folder2\\File.ext";
where the folder is located, as I said, in ProjectFolder\bin\Debug or ProjectFolder\bin\Release
¿When I access this folder, why is the DirectoryNotFoundException thrown?
Why if I put these folders into ProjectFolder\ and accessing with:
string file = "..\\..\\Folder1\\Folder2\\File.ext";
it gives me no problem??
Help please!
Thanx
|
|
|
|
|
Hi!
When you're using relative paths, you always have to be sure what's the current directory of the application.
You should NEVER assume anything regarding on what the current directory is, even showing an OpenFileDialog can change the current directory!
If you need a directory relative to your exe, you should use Application.StartupPath and build the path from there.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
sergestusxx wrote: ¿When I access this folder, why is the DirectoryNotFoundException thrown?
You are getting the exception because folder\folder\folder is not a properly formatted or valid path. On the other hand C:\Program Files\Something is a valid and properly formatted path.
sergestusxx wrote: string file = "..\\..\\Folder1\\Folder2\\File.ext";
As you see from the behaviour, this structure IS a valid path but you obviously do not know why. When you add ..\..\ you are telling File that you are accessing a folder relative to the current directory. In this case the Debug or Release folder of your application.
Follow the other suggestion and append your path with your Application ExecutablePath
|
|
|
|
|
Have you tried...
string file = "\\Folder1\\Folder2\\File.ext";?
I set my projects up to use an external directory structure (out side of the project\\bin\\..).
For example, inside my code I will setup some directory strings as the path to certain folders.
GetCurrentDirectory() + "\\Data\\" is where I would store my database.
GetCurrentDirectory() + "\\Art\\" is where I store my art files.
To set this up, inside the .NET project properties set the Output Pathto ..\\Folder\
Hope this helps.
|
|
|
|
|
Hi!
I tried the Application.StartupPath thing and it works fine. It was maybe caused by an OpenFileDialog I used just before.
I tried adding "\\" first, but the directory wasn't found either.
Thanks for the tip! I was going crazy
|
|
|
|
|
I have to go to develop the webtv application using C#,but i dont know the details about that concept if any body know just answer me
|
|
|
|
|
AFAIK webtv is just a normal web application.
|
|
|
|
|
How would i be able to read data out of the datagrid row by row ? I know how to do it in ASP but a Form's datagrid has different properties. Please help.
|
|
|
|
|
into a function looking like this :
setStatus(id as Integer, Status as System.Nullable(of Short))
The function is automaticly created in the DataSet-designer for "INSERT INTO Status ...."
Regards // Maw
|
|
|
|
|
That's VB. This is a c# forum.
using System.Beer;
|
|
|
|
|
Hi,
i am accessing visio's objects programmatically. I am able to know that in a page how many shape are there and what type of shapes are they. Now I want is to know that class object(s) in a window posses how many properties, Method, className etc. I am able to find out the descricption of process, doc, terminator etc. info. But problem with class object is it contains data in row format. plz do reply soon.
|
|
|
|
|
Hi.
I am experimenting with threading and I made the following simple program:
Thread blue = new Thread(new ThreadStart(bluebegin) );
Thread yellow = new Thread(new ThreadStart(yellowbegin) );
Thread red = new Thread(new ThreadStart(redbegin) );
blue.Start();
yellow.Start();
red.Start();
....
....
public void bluebegin()
{
this.BackColor = Color.Blue;
Thread.Sleep(2000);
yellowbegin();
}
public void yellowbegin()
{
this.BackColor = Color.Yellow;
Thread.Sleep(500);
redbegin();
}
public void redbegin()
{
this.BackColor = Color.Red;
Thread.Sleep(3000);
bluebegin();
}
I don´t know how to stop one or all threads. I have tried adding to one of the methods : blue.Abort(); but then I am told that the namespace blue could not be found. Can someone please help me?
Thanks,
F
|
|
|
|
|
Try creating a click event or a button where you can abort the threads, not in their thread methods.
|
|
|
|
|
public void bluebegin()
{
bool notTerminated=true;
public bool NotTerminated { get; set; }
while ( NotTerminated )
{
this.BackColor = Color.Blue;
thread.Sleep(500);
}
}
That should be enough to have you figure out what to do next.
-- modified at 10:10 Wednesday 19th April, 2006
|
|
|
|
|
I have this new defined object called oBLCLass.
I have a class named service with the function getObject().
aTempList is a string array.
See my codes below:
oBLClass = service.getObject(aServiceList(i))
aTempList = oBLClass.GetStatusLanguageKeyList()
GetStatusLanguageKeyList() is a function that generated after passing the "aServiceList(i)" into service.getObject() and the values will be assigned into the new defined object,oBLClass.
I am facing the problem to code in C# because
"'object' does not contain a definition for 'GetStatusLanguageKeyList'.
Can anyone there provide me with the solution? I will be grateful.Thank You very much!
|
|
|
|
|
You need to cast it to the correct type, but seeing as you have not provided the definition of oBLClass I have no idea what it is called to show you the code.
however, say oBLClass is an instance of MyBusinessClass
MyBusinessClass oBLClass;<br />
......<br />
oBLClass = (MyBusinessClass)service.getObject(aServiceList(i))<br />
aTempList = oBLClass.GetStatusLanguageKeyList()
|
|
|
|
|
the oBLCLass is defined as below
public object oBLCLass;
thank you!
|
|
|
|
|
well then, the error was correct (surprise) - object does not have a definition for your method.
Maybe explain a little more about what you are trying to accomplish, rather than how you are trying to accomplish it.
|
|
|
|
|
Actually i just wanna convert the code from VB.net to C#.
VB.net can recognise the "GetStatusLanguageKeyList()" though it's not declared in public class oBLCLass but, C# cannot recognise it.
|
|
|
|
|
|
You can check browser type with help of JavaScript,
and load different content which have been previosly tested for specific browser.
Best regards, Alexey.
|
|
|
|
|
You should first try and write valid markup (a valid markup is a markup that can pass the validator).
If you will still have problems after that browse the web and look for compatibility issues...
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
I am facing a problem when using VSTS with NUnit 2.2.6.
I am testing a website. After opening the browser it closes immidiately and
I am getting the following error.
!!!SCENARIO FAILURE!!!
Info: Failed to execute test cases due to run time error: ‘The HWnd is no longer valid’
Image: file:///C:\Program%20Files\NUnit-Net-2.0%202.2.6\bin\MAUI_Chrome%20MastHead%20section-Scen10.jpg
Is the problem with NUnit 2.2.6? Let me know.
Thanks in advance
Deeps..
|
|
|
|
|
how can I transfer a file using TCP packet by packet (regardlless the packet size)?
how can I transfer a file using UDP packet by packet (regardlless the packet size)? or on another mean
how can I do the folloing:
J.U.S.T
|
|
|
|