|
I tried looking for tooltip event but couldn't find. Is there any resource you could think of that might give me the right direction
Thanks
|
|
|
|
|
netJP12L wrote: Is there any resource you could think of that might give me the right direction
Starting from where? You don't appear to know anything and are incapable of using documentation to learn anything. You just come and post questions here. Maybe this might help[^], but I doubt it.
led mike
|
|
|
|
|
Guys,
I have a comnosle application that runs as a job in the middle of the night and displays the info via console.write line.
I have a question:
Is there any way to eather retrive what is written in the screen and write to a file or is there anyway to dump the content of the screen to a file without having to make many modification where ever I have console.write line
Please advice guys!
Thanks a lot!
|
|
|
|
|
|
I tried this at the very end of main thread but nothing got written
//here call a method that does console.write lines
//when done do the code below and file is empty
FileStream fs = new FileStream(@"c:\out1.txt", FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
Console.SetOut(sw);
sw.Close();
fs.Close();
Please advice with some more details
|
|
|
|
|
No the code to set the output stream must go in the console app itself.
|
|
|
|
|
here is my code
class utility {
[STAThread]
static void Main(string[] args)
{
ProcessRecords();
//here I placed the code for redirecting to output as above but it did not work. The function ProcessRecords does have some console.writeline statements
}
|
|
|
|
|
nesfrank wrote: here I placed the code for redirecting to output as above but it did not work. The function ProcessRecords does have some console.writeline statements
Except the Console.WriteLine() statements have already been written to the console You must do it before you actually do anything else. I suggest you move it to the beginning of Main().
Cheers,
Vıkram.
"You idiot British surprise me that your generators which grew up after Mid 50s had no brain at all." - Adnan Siddiqi.
|
|
|
|
|
You don't have to change anything at all in the code. You can pipe the output from the program into a file when you run it.
To send the output to the file "app.log":
TheApplication.exe > app.log
To apppend the output (keeping previous results):
TheApplication.exe >> app.log
If you can't add this from where you run the application, create a batch file (.bat) that contains a line as I showed above, and start the batch file instead of the application.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
is that supported in c# or is it c++? please send me some more details of code pls.
|
|
|
|
|
Neither, it's a shell/OS feature. Did you actually try it?
Cheers,
Vıkram.
"You idiot British surprise me that your generators which grew up after Mid 50s had no brain at all." - Adnan Siddiqi.
|
|
|
|
|
I am sorry but I don't get what neds to happen. can u send me a bit code
like console.write line and out put it? please help me if u can otherwise I would have to collect all console.write line in a string builder.
|
|
|
|
|
Just start your program from a command prompt (cmd.exe), and add " > somfile.txt" after the program name, and the output of the program is sent to the file.
This is built into the command shell, and you can for example send a directory listing to a file:
dir c:\users\nesfrank\documents > myfiles.txt
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
There is NO code to be written. Your app (let's call it Foo.exe) has several Console.WriteLine() statements which write to the console, and you want them to be written to a file (let's call it AppLog.txt).
Right now, this is how you would invoke your app:
C:\>Foo.exe Simply change that to
C:\>Foo.exe > AppLog.txt If you want the app to append to the file rather than overwrite, use
C:\>Foo.exe >> AppLog.txt Obviously, you will have to use the correct path, etc.
Cheers,
Vıkram.
"You idiot British surprise me that your generators which grew up after Mid 50s had no brain at all." - Adnan Siddiqi.
|
|
|
|
|
Additionally to what the others already said, there's also a slightly more advanced, yet more flexible solution:
log4net[^]
It has some nice features:
- you can specify where the log messages should go (like to the console, to a file, via mail and much more)
- you can add a custom format to your log messages (like a timestamp)
- you can specify the type of the log message, like Info, Warning, Error, Debug and much more
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi
if no element return from this i need "loct" to be null
int? loct = (from s in sdc.Locations
where s.Name == listViewEx4.Items[i].SubItems[7].Text
select s.Location_ID).SingleOrDefault();
First() return error message Sequence contains no elements
SingleOrDefault() return 0
i need null from this sequence
how can i do
modified on Wednesday, November 12, 2008 10:46 AM
|
|
|
|
|
mutafa81 wrote: how can i do
no, try to compile this:
int n = null;
Now, read the compiler error message and think about your question. Good luck.
led mike
|
|
|
|
|
but the OP was using int? rather than int
|
|
|
|
|
J4amieC wrote: but the OP was using int?
ooops
led mike
|
|
|
|
|
Im guessing your field "Location_ID" is an int rather than an int?, in which case the default is 0 which can be assigned to the int?
you could try this:
int temp = (from s in sdc.Locations
where s.Name == listViewEx4.Items[i].SubItems[7].Text
select s.Location_ID).SingleOrDefault();
int? loct = (temp == 0) ? null : temp;
|
|
|
|
|
Thank you will try
J4amieC wrote: Im guessing your field "Location_ID" is an int rather than an int?, in which case the default is 0 which can be assigned to the int?
you could try this:
int temp = (from s in sdc.Locationswhere s.Name == listViewEx4.Items[i].SubItems[7].Textselect s.Location_ID).SingleOrDefault();int? loct = (temp == 0) ? null : temp;
|
|
|
|
|
I need to compile .net project in mono.
but I am getting errors while compiling it. Can anybody help me to do it?
as i do
mcs Program.cs Form1.cs Form1.Designer.cs AssemblyInfo.cs -r:System.Windows.Forms.dll -r:System.Drawing.dll -r:System.Data.dll
it gives me error, my program is not getting compiled, so please help me.
|
|
|
|
|
What error does it give you? You need to be more clear.
|
|
|
|
|
And the error would be ....... ????
Keep in mind that Mono is NOT a 100% direct replacement for .NET Framework code. So, System.Windows.Forms will not work on Linux, since it, surprise, is NOT WINDOWS.
|
|
|
|
|
This is the part where we try to become mind readers. It's a zen thing.
"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
|
|
|
|