|
Colin Angus Mackay wrote:
The Main method is static, it doesn't require an instance of the class to operate, so you would never get a finalizer called if that is all you were using.
I do declare a new object of the same class (TiffConverterClass) in the main method. So i definetely instantiate it. But i hear your advice on Finalizers so....
Are there any alternatives to actually get my program to write to a log file just before terminating??
|
|
|
|
|
How about at the end of your Main method?
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
I tried that but...
the problem is that in my main method I instantiate the class and then call a method of that class that does all the work (this method sets up the timer) but I have to put in a Console.ReadLine() right at the end to stop the program from ending. If i put it before the Console.ReadLine() then it doesn't actually write it when the program ends and if i put it after it never gets there.
|
|
|
|
|
I'm not certain, but this could be something to do with garbage collection (C# destructors don't work the same as C++ destructors - clicky[^]) - apparently there's no guarantee that a class's destructor will ever be called (so maybe this is your problem)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
Very easy.. replace delegate with anything you need
using System;
namespace ConsoleApplication1
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
}
private static void CurrentDomain_ProcessExit(object sender, EventArgs e)
{
Console.WriteLine("Bye");
}
}
}
-
Drew
|
|
|
|
|
Hi,
I am using OpenFileDialog to browse the file path ans select the file path in textbox1 and enter ID and another textbox2 in windowform when user opens first time then next time when they open this form i want the filename and ID to appear automatically whatever they entered before. I know how to use in asp.net with config file but with windowforms any idea ???
Thanks,
|
|
|
|
|
you can set the contents of a text box using it's .Text member
i.e.
when you init the form:
textbox2.Text = SomeStringVariable;
and then when you're done with the form
SomeStringVariable = textbox2.Text;
(so just keep this string in a static variable in your form's class, and it'll remember it)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
Hello
I have a SQL statement which is long. How do l write it so that it is on serveral lines.
This is what l have tried to do.
<br />
CnnStr = "SELECT student.studentID, student.FirstName, student.LastName" +<br />
"book.bookID, book.Title" +<br />
"FROM student, book" +<br />
"WHERE student.studentID = book.studentID";<br />
This does not work, and anyone tell me how to do this.
Many thanks in advance,
Steve
|
|
|
|
|
add at the beginig and end of an string a space (0x20 char)
your code needs to look like this in order to work
<br />
CnnStr = " SELECT student.studentID, student.FirstName, student.LastName " +<br />
" book.bookID, book.Title " +<br />
" FROM student, book " +<br />
" WHERE student.studentID = book.studentID ";<br />
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
You're missing a comma after Student.LastName
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
To consolidate the above answers:
CnnStr = "SELECT student.studentID, student.FirstName, student.LastName," +
" book.bookID, book.Title" +
" FROM student, book" +
" WHERE student.studentID = book.studentID";
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
This may be a dumb question, but does your statement work when it is just one long line?
alphanorm
|
|
|
|
|
Three things:
1. You need to leave the proper spaces between things like Title and FROM.
2. You need to add a comma after LastName.
3. You can also use the @ sign in front of the string to avoid the extra quotes and + signs:
CnnStr = @"SELECT student.studentID, student.FirstName, student.LastName, <br />
book.bookID, book.Title <br />
FROM student, book <br />
WHERE student.studentID = book.studentID";
Regards,
Alvaro
Our enemies are innovative and resourceful, and so are we. They never stop thinking about new ways to harm our country and our people, and neither do we. - George W. Bush
|
|
|
|
|
hello all,
Tell me, how to make a site as globalization using CultureInfoConverter. Ie. Translate languages in web page.
Thanks
|
|
|
|
|
codes/w wrote:
CultureInfoConverter
Will not do language translation for you. You have to supply the text in every language you want to support.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Hi..,
Is any body have a knowledge like how to create a user control like that the description is below:-
[1]ComboBox : TextBox : TextBox : TextBox :
and Also in some fields like textbox in readonly mode and we can change its property at rumtime.
[1]ComboBox : TextBox : TextBox : TextBox :
and it's repeat at the runtime as user use Tab Button
Muhammad Waqas Butt
|
|
|
|
|
|
Im working on a C#2.0 grid control, its on hold for the moment as ive just started uni, but you can have the source if you want, it will be open-source when complete
The example only uses TextBoxes for editing, but new editor types can be created.
http://www.onyeyiri.co.uk/misc/Grid.zip
|
|
|
|
|
Hi~
I use the code in "pocket pc network programming". The code cannot get the body of a email.(return ""). So can any help?
Thanks
|
|
|
|
|
Hi,
By fetching the logical drive from a folder I'd like to test what file system I'm on (NTFS or FAT16/32). Have tried to figure out how that is done but so far been unable to find any useful way to achieve this in neither System.IO or using ManagementObjectSearcher (WMI).
Anyone that can hint me where to look?
|
|
|
|
|
U can obtain that using WMI.
try on www.csharphelp.com/arhives3/arhive585.html?ptintable=yes.
Is 2nd part for WMI and there u will find a full application source code - see list of logical drives in that app.
Hope this will help u .
|
|
|
|
|
Yeah, it looks promising. I'll give it a try on Monday. Have a nice weekend.
|
|
|
|
|
Hi~
The MAPI PR_ENTRYID is a structure consist of 2 members - LPBYTE lpb and ULONG cb.
I would like to know is the LPBYTE is a type of encoded string or what is it? It is an entry ID and I would like to convert whatever number or string. How to convert it ?
(p.s. LPBYTE is the pointer of byte array and the member cb is the array size)
Thanks
|
|
|
|
|
Entry ID is an array of bytes. CDO 1.21 represents it as a String.
You can convert the String to the byte array...
private static byte[] StringToByteEntryId(String strEntryId){
byte[] entryId = new byte[strEntryId.Length/2];
String strByte;
int byteIndex = 0;
for(int n=0; n<strEntryId.Length; n+=2){
strByte = strEntryId.Substring(n, 2);
entryId[byteIndex] = Convert.ToByte(strByte, 16);
byteIndex++;
}
return entryId;
... and vice versa:
private static String ByteToStringEntryId(byte[] bytes) {
StringBuilder result = new StringBuilder(bytes.Length*2);
String currentNumber;
foreach(byte b in bytes) {
currentNumber = b.ToString("X2");
result.Append(currentNumber);
}
String entryId = result.ToString();
return entryId;
}
|
|
|
|