|
You should implement the dispose pattern[^] and dispose of the object. Setting it to null only flags it as being available for cleanup when garbage collection comes around, which you have no idea when will happen. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Your teacher told you to pay attention and not destroy the class.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
I don't know whether I am asking a stupid thing.
I can develop an application that can read emails for me and can send SMS alerts for every new mail.
That application keeps on monitoring my inbox. But I want it to execute 24 hr a day.
Is it possible to make an exe executing all the time online in some other online service or machine.
Something like a program running in cloud(cloud computing)
|
|
|
|
|
Whell, any process can run 24 hours a day 365 days a year. All you need to never close or terminate process or shut-down computer. If you attempt to create process designed for monitoring, then I recommend you to create services.
Gjm wrote: Is it possible to make an exe executing all the time online in some other online service or machine
Normal monitoring application/services needs to be installed on a computer/machines that is supposed to be used.
|
|
|
|
|
You might be looking for a windows service.
Just check whether creating a Windows Service will help you or not.
|
|
|
|
|
Don't post the same question to multiple forums I know the language. I've read a book. - _Madmatt
|
|
|
|
|
this is the code segment i used
int? x = null;
int? y = null;
if (x >= y)
{
Console.WriteLine("x is greater than y ");
}
else
{
Console.WriteLine("x is less than y ");
}
as i read if you compare two nullable types that both are having null it should be true, but i get the false (as in the code "x is less than y " )
can anyone tell me why ?
|
|
|
|
|
If both are null, operator >= can't compare, because it doesn't have value.
prasadbuddhika wrote: as i read if you compare two nullable types that both are having null it should be true
I think if you compares with operator == (Equal) it would be true, because both would be equal.
prasadbuddhika wrote: ut i get the false (as in the code "x is less than y " )
if first block is false then your else block would run instead. However what you want is use this:
if (x > y)
{
Console.WriteLine("x is greater than y ");
}
else if (x < y)
{
Console.WriteLine("x is less than y ");
}
Eidt: Forgot pre tagsmodified on Saturday, February 13, 2010 11:01 AM
|
|
|
|
|
I recommend you avoid all nullable compares other than aNullable == null
how to compare nullables needs careful definition.
And it has been established C# and VB.NET use different definitions for it!
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Hi,
This alternative test clarifies what is going on and I think the take home message is that nullable types must contain a value before a comparison can be made. It's very confusing when x == y is true but x >= y is false and I'm sure this will catch many people out.
static void Main(string[] args) {
int? x = null;
int? y = null;
Compare(x, y);
x = 1;
Compare(x, y);
Console.ReadLine();
}
private static void Compare(int? x, int? y) {
Console.WriteLine("{0} >= {1} {2}", x == null ? "null" : x.ToString(), y == null ? "null" : y.ToString(), x >= y);
Console.WriteLine("{0} > {1} {2}", x == null ? "null" : x.ToString(), y == null ? "null" : y.ToString(), x > y);
Console.WriteLine("{0} == {1} {2}", x == null ? "null" : x.ToString(), y == null ? "null" : y.ToString(), x == y);
Console.WriteLine("{0} < {1} {2}", x == null ? "null" : x.ToString(), y == null ? "null" : y.ToString(), x < y);
Console.WriteLine("{0} <= {1} {2}", x == null ? "null" : x.ToString(), y == null ? "null" : y.ToString(), x <= y);
Console.WriteLine();
}
Alan.
|
|
|
|
|
I suggest you perform a similar test using VB.NET and compare results. They made really surprising decisions when introducing nullables.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
I was going to give an excuse about not having the compiler installed but I knew I'd never get that past you. The best I could do with the VB 8.0 compiler, not having used Basic since 1993 was
Class Sample
Public Shared Sub Main()
Dim x as Nullable(Of Int32): Dim y as Nullable(Of Int32)
x = Nothing: y = Nothing
Compare(x, y)
x = 1
Compare(x, y)
x = Nothing: y = 1
Compare(x, y)
Console.ReadLine()
End Sub
Public Shared Sub Compare(x as Nullable(Of Int32), y as Nullable(Of Int32))
Dim xvalue as String: Dim yvalue as String
If x.HasValue Then
xvalue = x.ToString()
Else
xvalue = "Nothing"
End If
If y.HasValue Then
yvalue = y.ToString()
Else
yvalue = "Nothing"
End If
Console.WriteLine("Nullable.Equals({0}, {1}) {2}", xvalue, yvalue, Nullable.Equals(x, y))
Console.WriteLine("Nullable.Compare({0}, {1}) {2}", xvalue, yvalue, Nullable.Compare(x, y))
Console.WriteLine()
End Sub
End Class
Nullable.Equals(Nothing, Nothing) True
Nullable.Compare(Nothing, Nothing) 0
Nullable.Equals(1, Nothing) False
Nullable.Compare(1, Nothing) 1
Nullable.Equals(Nothing, 1) False
Nullable.Compare(Nothing, 1) -1
So the difference is that C# relational operators and the Nullable.Compare method give different results?
Alan.
|
|
|
|
|
Alan N wrote: I knew I'd never get that past you
You're right
Here[^] is my take on the "Nullable Comparison" issue.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
modified on Saturday, February 13, 2010 4:36 PM
|
|
|
|
|
Here[^] is my take on the "Nullable Comparison" issue. I can't explain why it does what it does, I can only observe and live with it.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
thank you for all who replied me , i read an article about nullables in MSDN site, and i didn't get the expected result when i test them , that's why i posted it here , now i see there are problems using nullables.
|
|
|
|
|
I am trying to drag a form by a panel control (because i removed the form border).
But i am not having any luck,
Any suggestions?
|
|
|
|
|
Use OnMouseDown, OnMouseUp and OnMouseMove events. Handle property Form.Location based on mouse move
|
|
|
|
|
i want to send file as msn messenger, how to transfer data between c# ListBox controls. or different. please help me.
|
|
|
|
|
Member 3391788 wrote: i want to send file as msn messenger
Do you know how to use TCP/IP Or UDP?
Member 3391788 wrote: how to transfer data between c# ListBox controls
It is easy as long it is same process. But in your case it is more than just sending listbox data.
|
|
|
|
|
SORRY I DON'T KNOW..HELP ME
|
|
|
|
|
|
|
hi,i am designing a invoice windows form in c# application.in this bill no is autogenerated from databse.
date,sale type is dere.book id also in the form element.when i will type the book id then slno,book name,price will be added in list box.and discount total amount etc.but finaly i want to print the page.in billing only billno,date,sale type and listbox data will be dere.i am unable to do this.plz help me its urgent.if u have any billing invoice format and other procedure please give me the idea and logic.how to design a billing invoice for book shop?its urgent plz help me.
|
|
|
|
|
If you want to print use either CrystalReports or DocumentPrinter. If you chose DocumentPrinter(I hope it is correct name) you would need to use GDI+ to print to Document. I Suggest to use CrystalReports, because it is easy.
sudhir behera wrote: its urgent plz help me.
Read the rules. For me it isn't urgent.
|
|
|
|
|
but i will i add label, list box,textbox etc in crystal report.is this possible to design form in crystal report?
|
|
|
|