|
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
|
|
|
|
|
You need to use some other protocol - it can, if you insist, be one you design yourself - on top of TCP because TCP does not preserve message boundaries, so you need to tell the receiver how much data to expect, or look for some terminator.
For example, HTTP terminates the headers with a blank line (the sequence CR-LF-CR-LF) and either uses the Content-Length header to indicate how much data is present, or closes the connection once all data has been transmitted (IIRC). FTP uses a separate connection for data transfer, the end of the data being signalled by closing the connection.
UDP preserves message boundaries but is not reliable - you have no way to know whether a particular packet has arrived unless you code the receiver to send acknowledgements. You often find that you end up reinventing about 90% of TCP if you try to come up with a multi-block data-transfer scheme. You should not send more data in one message than the network can actually fit into an IP packet (the Maximum Transmission Unit), because otherwise the datagram will be fragmented, which has a massively detrimental effect on datagram loss. Say that packet loss in the route to the receiver is 5%. The chances of a datagram that fits into a single packet arriving is 95%. The chances of a datagram that must be split into two packets (fragments) arriving successfully is 95% x 95% = 90.25%, so you now get nearly 10% packet loss. The problem gets worse the more fragments you have.
Unfortunately different networks have different MTU sizes. TCP has a feature called Path MTU Discovery which allows it to work out how much data it can send in one packet without causing fragmentation. This feature relies on Internet Control Message Protocol (ICMP) responses from routers when asked to process a packet too big for the network it would be sent on. These messages will not be passed on to your application by the TCP/IP stack, so you cannot reimplement this feature in your own UDP-based protocol.
Stick to using UDP for single request/response pairs that will fit in a single packet, and use TCP for everything else. For file transfers I'd definitely use TCP.
For more information on the protocols, see the Winsock Programmer's FAQ[^]. This is oriented more towards native, rather than managed, programming, but should still be useful.
The .NET Framework contains a canned implementation of the HTTP protocol - see the HttpWebRequest class. .NET 2.0 has an implementation of FTP: FtpWebRequest . If you want to implement your own TCP-based protocol, see TcpListener for the server end and TcpClient for the client end. For UDP, see UdpClient . If you want to program the sockets directly, there's also the Socket class.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I make a Setup Project in Visual Studio 2005 for my application. All works well but when I’m going to distribute an update in a new builded version of my application my clients have to first uninstall my application and then reinstall the new one.
I get the following error when I try to install my app again:
Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.
How do I do to make the new release be installed over the old one?
_____________________________
...and justice for all
APe
|
|
|
|
|
There are 2 possible answers here....
1. You didnt set the new uninstaller to uninstall the previous version before the new install.
2. You made a completely different installer that has a new product code, which can not uninstall the other version (directly). Installers (even for the same program) with a different product code can not uninstall another version with a different product code.
Solutions:
1. Set UninstallPreviousVersion to true, redistribute.
2. You will have to create a custom action script to find and uninstall the older version with a different product code. You can find it in the registry (Hikey/Local Machine/Microsoft/Windows/CurrentVersion/Uninstall) by the old product code. You will need to run the uninstall string as a process. A note with this is that you cant have 2 instances of windows installer running at once, so you will need to create a custom action script to run on install that will fire the uninstaller program. The uninstaller should wait for the installer to exit before attempting to windows installer will not run to uninstall the program.
HTH.
Aaron
|
|
|
|