Ashwani, Of course the easy answer is YES...the garbage collector will eventually get everything sooner or later(even if it has to wait for a reboot :laugh: ). The better question, and the one they probably intended was, "Are the objects of Class1 and Class2 marked for GC or not?". The answer is still yes. I assume the bold on the GC.SuppressFinalize(this); line is primarily what they are asking about. That line HAS NO MEANING WHATSOEVER IN THIS CONTEXT. That line is meant to short circuit the running of a destructor/finalizer for a class. Since neither of the classes has a destructor defined, the line of code does nothing. In this case both classes will be marked for GC at the end of the click event code. HTH WhiteWizard(aka Gandalf)
MCSD Gandalf
Posts
-
Garbage Collector -
c#If you want a really good beginner's book, look at C# Step by step. I don't normally recommend MS books, but the Step by Step series is a very good one for getting started with something new. HTH WhiteWizard aka Gandalf
-
Saving list box contentsIt would be REAL handy to know what type of application you're talking about, but I'm assuming a Windows app. Generally it would be really easy to save the contents to a small XML file, then at startup check to see if that file is present. If it is, put the contents back in the listbox, and if not, it would be empty. HTH WhiteWizard aka Gandalf
-
how to track label control with keyboardI hate to be the bearer of bad news, but you can't select Label boxes with the tab key. Labels are not designed to get the focus, if you want your image to get the focus, you'll have to put it in another type of control. WhiteWizard aka Gandalf
-
validationA lot of this is going to depend on two things; how complicated is your validation? and how good is your java. The validation controls just generate java script to run on the client, so you are not buying anything by doing it in java unless you have some validation that the controls won't do. The big advantages of using the validation controls is that you don't have as much code to write or support AND the validation automatically happens on the client AND the server side. If you write your own java script, and want the added security of having the validation run on the server, you'll have to code it there as well. HTH WhiteWizard aka Gandalf
-
Globalization and Localization in C#.I have not had to do this yet either, but I have found Matthew MacDonald's book, "User Interfaces in C#" from Apress books extremely helpful, and it appears he has a "cookbook" approach to this in one of his chapters. I am going to have to do this as well in a little while. I'd like to hear from you on how your experience goes. WhiteWizard aka Gandalf
-
[Message Deleted]Ok, I don't mind helping out here, and have gotten help here, BUT it is frustrating when people ask the SAME QUESTION over and over. You asked basically this SAME question two days ago. What part of C# DOES NOT GENERATE OBJ FILES did you not understand? Do some reading on the environment on your own. This is BASIC to the .NET platform. This is C# w/.NET and NOT C or C++. Get over it or code in those languages. Sorry for the rant guys. :laugh: WhiteWizard aka Gandalf
-
Date Time in c#If you look at the documentation it states that if the day is a single digit it will be returned as a single digit. I would think it doesn't matter how it is stored internally, but how it is displayed. If you want a day to be displayed with a leading zero, use "dd" in the format string. Here is the link from the MS help files: ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconcustomdatetimeformatstrings.htm HTH Gandalf
-
How to store sessions in first page in asp.net [modified]Sounds like you should break out your text book, and see if you can get this information from there. That's why it's called homework. :-D
-
Changing Fontsizes in ControlsThanks! I combined your code with mine and got just what I needed. Here's what I ended up with: private void button3_Click(object sender, System.EventArgs e) { System.Drawing.Font currentFont= listBox1.Font; FontStyle fs= currentFont.Style; float fontsize = this.listBox1.Font.Size; fontsize++; if (fontsize > 20) { fontsize = 8; } listBox1.Font = new Font(currentFont.FontFamily, fontsize, fs); } Gandalf
-
Converting Datagrid to Excel sheet in C#So...let me get this straight. You posted this EXACT same message about 1/2 an hour ago, got a response in something like 7 minutes, but posted again....why? Didn't like the response? Didn't understand the response? Did you READ the response?
-
Changing Fontsizes in ControlsIt is always the simple things that get ya'. Is it me or does MS INSIST on making the easy things hard to do? All I need to do is increase the fontsize of a control. Seems I should be able to just add to the current fontsize, but of course I am not allowed to do that. Oh by the way I can't use the Font Dialog. Here is what I've come up with. Anyone have any better ideas? private void button3_Click(object sender, System.EventArgs e) { System.Drawing.Font currentFont= listBox1.Font; FontStyle fs= currentFont.Style; switch (currentFont.Size.ToString()) { case "8": listBox1.Font = new Font(currentFont.FontFamily, 10, fs); break; case "10": listBox1.Font = new Font(currentFont.FontFamily, 12, fs); break; case "12": listBox1.Font = new Font(currentFont.FontFamily, 15, fs); break; case "15": listBox1.Font = new Font(currentFont.FontFamily, 8, fs); break; } } Thanks in advance. WhiteWizard(aka Gandalf)
-
C# BooksAs an instructor I get this question a lot. The Inside C# by Tom Archer is a good "intermediate going towards advanced" programmer. I wore my copy of the first edition out, very useful. If you need an advanced book, I would recommend either CLR via C# by Jeffrey Richter, which is terrific for figuring out what is going on under the covers, or a more practical book, Practical .NET2 and C#2 by Patrick Smacchia. HTH
-
DateTimePicker ValueChanged event fires twicePaula, The reason it is firing twice is because you are changing it twice; once when you select on the form and another with your line of code just before your return where you change it back to the current date. HTH
-
which datatype will be appropriate for Ratio calculation in C#One more quick thing on Decimal datatypes. Although the C# language considers this a primitive datatype, the CLR does NOT. From a practical standpoint, this means that manipulating Decimal datatypes is slower than working with the other datatypes. Also, the checked and unchecked operators, and compiler switches have no effect on Decimal datatypes, which ALSO means that Decimal datatypes ALWAYS throw an OverflowException if the operation can't be done safely. I was surprised by this, I am pretty sure I read it in Jeff Richter's book, and played with it some and he's right. I HATE it when that happens!:laugh:
-
Event issueIn Windows applications, if there is ANY control on a form that CAN receive the focus it does, and the form does not. You are correct, it is a focus issue, and it was designed that way. HTH explain it anyway. ;)
-
changing a column type of datagridview ?Seems to me the easiest solution is to make the first column a STRING. All you are doing is using it for displaying data anyway. Verify that it is a valid value, convert it to a string for display in the datagrid. If you need to pull it out, all you have to do is cast it back to whatever numeric datatype you are using. HTH Gandalf
-
switching between formsI may be missing something but... Add a second form to your application, assume it is Form2. In some event on Form1 (button click whatever), put the following code Form2 frm2 = new Form2(); frm2.Show(); Both forms should be open and available. All you have to do is make sure that neither of them is maximized. You can even limit the size with the MaximumSize property so neither of them takes the whole area. HTH Gandalf
-
tabcontrol problem ? howto check if a different tab is clicked ?I use the tabcontrol quite a bit in my application, and although you CAN use the index of the tab pages, using the text property gives you a bit more flexibility IMHO. For instance, so far my users have added 3 different tab pages, and deleted 2 of them, and changed the order of them 3 more times. By using the tabControlName.SelectedTab.Text property instead of the index, I don't have to change NEARLY as much code when things change, and my maintenance programmers will have a much easier time too. ;) HTH Gandalf
-
How to get combo itemsVery true. Of course HOPEFULLY if you have stuffed something else in there you know what it is and can write the appropriate foreach loop. And if not I guess you can always treat everything in there as an object and write the foreach loop that way. Guess I need to be a bit clearer around here with all you guru's watching:laugh: ! Thanks! Gandalf