|
How many times have you been told already not to use a subject line of "C#" when you are posting in the C# forum - It is redundant.
Please read this article[^]
|
|
|
|
|
I have the feeling, that he is doing it for fun.
He loves too see us going crazy!
All the best,
Martin
|
|
|
|
|
Martin# wrote: I have the feeling, that he is doing it for fun.
You underestimate human stupidity.
Cheers,
Vıkram.
Be yourself, no matter what they say.
- Sting, Englishman in New York.
|
|
|
|
|
Hi All,
I have to use two sub reports in a main report.
But, I am getting the error, Subreport could not be shown.
There are no articles or blogs for this multiple reports in main report.
Can anybody help me on this????
-Saran
|
|
|
|
|
Do you have any c# code that would export registry file? and save it as text format?
pls help...
I know how to manually export registry file thru registry editor. But how do we do it programmatically using c#?
Thanks
|
|
|
|
|
|
Use Microsoft.Win32 namespace. You can find there a RegistryKey class:
RegistryKey root = Registry.LocalMachine;
Then create a recursive method which would scan the whole registry, using GetSubKeys, GetValueNames and GetValue methods. The recurse would hang on the iteration through GetSubKeys method.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Error: The given path's format is not supported.
I am trying to upload from a page to the webserver and I got this error.
the code is just this
public void Upload_ServerClick(object sender, System.EventArgs e)
{
string baseLocation = "ftp://layer3media.com/DataGroup/Test/";
string status = "";
Label1.Visible=true;
foreach(System.Web.UI.HtmlControls.HtmlInputFile HIF in hif)
{
string fn = System.IO.Path.GetFileName(HIF.PostedFile.FileName);
HIF.PostedFile.SaveAs(baseLocation + fn);
filesUploaded++;
status += fn + "
";
}
}
}
Pravin
|
|
|
|
|
pavya_Cool wrote: HIF.PostedFile.SaveAs(baseLocation + fn);
will not work when baseLocation is string baseLocation = "ftp://layer3media.com/DataGroup/Test/";
You may need to save the file to a temporary location and use a FTP Client API to transfer it to an appropriate FTP folder.
|
|
|
|
|
Hello,
pavya_Cool wrote: string baseLocation = "ftp://layer3media.com/DataGroup/Test/";
use:
string baseLocation = "ftp://layer3media.com//DataGroup//Test//";
or:
string baseLocation = @"ftp:/layer3media.com/DataGroup/Test/";
-- modified at 4:38 Tuesday 28th August, 2007
Useless post!
All the best,
Martin
|
|
|
|
|
Escape characters begin with '\', not '/' -- "\D" wouldn't even compile...
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
No comment!
All the best,
Martin
|
|
|
|
|
Martin,
Your @ prefix suggestion to override ESCape character was good. However, I don't think classes in System.IO namespaces support network file transfers.
|
|
|
|
|
Hi
I am using Visual Studio 2005 and C# for a Windows application. I am referencing a class in a different namespace from my main class. When I try to debug it tells me "There is no source code available for the current location." When I look at the properties of the reference, the path to the other namespace is correct. Also when I run it it does call the correct methods in the other namespace.
It is just very frustrating that I cannot debug it.
Anybody else seen this before.
Thanks.
Kobus
|
|
|
|
|
Is your project compiled in DEBUG mode and you have all required PDB files in place?
|
|
|
|
|
I did.
1.) It happens when an exception occurs within Framework .NET. The solution is to put a breakpoint before a certain excpetion occurs (you have to find out an approximate location in the code) and then debug step by step up to the broken code. The fastest way is to put a breakpoint before the method call (not inside it's body).
2.) Check if your use "Debug" configuration (not "Release"), because some stuff may be optimized out.
3.) You are able to debug only if you reference to a project (when u can access the code through IDE), not just a DLL file.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
I want to read external application exe name when it’s focused. It’s like this.
Consider now MSWord, Notepad and Google Talk are running in my computer as minimized (nothing focused). If I will click on notepad icon at taskbar to restore it, I want to pop-up a message box to say application name as Notepad.exe (because now it’s the focused application).
Please help me. Thanks.
|
|
|
|
|
Hello,
I think the "System.Diagnostics.Process" in combination with "user32.dll" method "IsIconic" could help you.
I did a little test:
First I Import the method from the user32.dll:
[System.Runtime.InteropServices.DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool IsIconic(IntPtr hWnd);
I declare two ArrayList: one for all processes (with mainwindowhandle), and one for the Procceses which state is Iconic.
using System.Collections;
private ArrayList ProcessesWithMainWindow = new ArrayList();
private ArrayList ProcessesIconic = new ArrayList();
Then I have a method which checks all Process.
If the process has a mainwindowhandle, it will be added to a ArrayList for further usage.
Additionally I enable the "EnableRaisingEvents" property of the processes and handle the "Exited" Event.
private void SearchRunningProcesses()
{
Process[] allRunningProcesses= Process.GetProcesses();
foreach(Process actProcess in allRunningProcesses)
{
if(actProcess.MainWindowHandle!=IntPtr.Zero)
{
if(!ProcessesWithMainWindow.Contains(actProcess))
{
ProcessesWithMainWindow.Add(actProcess);
actProcess.EnableRaisingEvents = true;
actProcess.Exited+=new EventHandler(actProcess_Exited);
}
}
else
{
actProcess.Dispose();
}
}
}
Then I added a method which validates the Processes inside the "ProcessesWithMainWindow " List, by checking "IsIconic".
If a processes mainwindow is iconic, I add it to the "ProcessesIconic" List.
If it is not iconic but is in the "ProcessesIconic" List, it would mean that the state of the meinwindow has changed and you could show your messagebox there.
private void ValidateProcesses()
{
foreach(object actObject in ProcessesWithMainWindow)
{
Process actProcess = actObject as Process;
if(actProcess.MainWindowHandle!=IntPtr.Zero)
{
if(IsIconic(actProcess.MainWindowHandle))
{
if(!ProcessesIconic.Contains(actProcess))
{
ProcessesIconic.Add(actProcess);
}
}
else
{
if(ProcessesIconic.Contains(actProcess))
{
ProcessesIconic.Remove(actProcess);
}
}
}
}
}
If the Exited event of a process get's fired, I remove the instance out of the collections, unregister the event and dispose it.
private void actProcess_Exited(object sender, EventArgs e)
{
Process actProcess = sender as Process;
ProcessesWithMainWindow.Remove(actProcess);
if(ProcessesIconic.Contains(actProcess))
{
ProcessesIconic.Remove(actProcess);
}
actProcess.Exited-=new EventHandler(actProcess_Exited);
actProcess.Dispose();
}
You can call the two methods in a tick or elapsed event of a timer.
SearchRunningProcesses();
ValidateProcesses();
Note: I just did a quick test, which means that it might not work under all conditions.
Hope it helps!
-- modified at 6:17 Tuesday 28th August, 2007
actProcess = null;
All the best,
Martin
|
|
|
|
|
Dear Martin,
Thank you very much for your valuable time and knowledge. Now I am trying to apply the method you mentioned. If there will be any question then I will continue this thread again. Thanks.
|
|
|
|
|
You are wellcome!
All the best,
Martin
|
|
|
|
|
Hi,
I'm currently in the process of developing an utility that executes the SQL Query's.
(More or less similar to SQL QUERY ANALYZER).
I have defined the Database name in the App.config file itself.
And , t's working fine.
Now the problem is, I need to modify the Database Name in the App.config while I select the
Database name from the Listbox automatically.
The app.config file code is
<configuration>
<appsettings>
<add key="QueryAnalyzer" value="Data Source=(local);Integrated Security=True;User ID=;Password=;Initial Catalog=Northwind">
Please any one help me in finding the solution
BhuMan
|
|
|
|
|
I am working on an existing c# code which reads .csv files.
Some of these files are about 120 MB in size.
When the program is going through these big files it produces the following error.
Message: "Exception of type 'System.OutOfMemoryException' was thrown."
I have been asked to solve this issue in the code.
Any thoughts please?
Thanks
|
|
|
|
|
Hello,
A wild guess:
Maybe you are not Closing / Disposing the file streams!
It would help us to help you, if you show some code snippeds.
All the best,
Martin
|
|
|
|
|
|
To me this happend when I created a non terminating recursion. Maybe you are hanging in some loop? Forgot to increase the index while creating new objects?
Rudolf Heijink
|
|
|
|