
donnacha
Avatar/Signature-
Posts
189 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by donnacha
-
I presume a large % of this comes from loading the CLR or else it is a business arrangment between Microsoft and the memory manufacturers. Have you tried calling the GC direct to free any unused memory(Gc.Collect) it might help. As well as using Dispose, add setting the variable to 'Nothing'
-
Not too sure if you have solved your problem (didn't follow the dutch. but you can do what you want by programatically adding the form as a control to the panel you want in the same way as the designer code does it for something like a button. I have used this and it works like a dream.
-
There are several recent threads on this memory subject, the jist of them is tha while it looks to be using less memory when minimised, it is not, it has written the data to disk instead of holding it in memory. when you maxamise it again, it will quickly get back to the origional amount. The whole memory management is very scarey to say the least....
-
Hi folks those articles also talk about the "un-dead" objects that could be resurected from the GC (but not recommended, as you would assume).
-
How do you add the row, programatically or is the user entering it in the datagrid.
-
If you are using the datagridstyle to set it up you can just leave the clume out of the style definition or if you want it to be in the grid and readable by your code but not visible just set the width for that column to 0.
-
Hi folks, I agree with all ye say and have implemented it this way, but my question is arising from the MSDN articles I listed above. The following is an estract from one of them ---------------------------------------------------------------------- "How Finalization Affects Collection When the garbage collector first encounters an object that is otherwise dead but still needs to be finalized it must abandon its attempt to reclaim the space for that object at that time. The object is instead added to a list of objects needing finalization and, furthermore, the collector must then ensure that all of the pointers within the object remain valid until finalization is complete. This is basically the same thing as saying that every object in need of finalization is like a temporary root object from the collector's perspective. Once the collection is complete, the aptly named finalization thread will go through the list of objects needing finalization and invoke the finalizers. When this is done the objects once again become dead and will be naturally collected in the normal way. Finalization and Performance With this basic understanding of finalization we can already deduce some very important things: First, objects that need finalization live longer than objects that do not. In fact, they can live a lot longer. For instance, suppose an object that is in gen2 needs to be finalized. Finalization will be scheduled but the object is still in gen2, so it will not be re-collected until the next gen2 collection happens. That could be a very long time indeed, and, in fact, if things are going well it will be a long time, because gen2 collections are costly and thus we want them to happen very infrequently. Older objects needing finalization might have to wait for dozens if not hundreds of gen0 collections before their space is reclaimed. Second, objects that need finalization cause collateral damage. Since the internal object pointers must remain valid, not only will the objects directly needing finalization linger in memory but everything the object refers to, directly and indirectly, will also remain in memory. If a huge tree of objects was anchored by a single object that required finalization, then the entire tree would linger, potentially for a long time as we just discussed. It is therefore important to use finalizers sparingly and place them on objects that have as few internal object pointers as possible. In the tree example I just gave, you can easily avoid the problem by moving the resources in need of finalization to a separate object and keeping a reference to that object in the root of the tree. With that modest change only the one object (hopefully a nice small object) would linger and the finalization cost is minimized. Finally, objects needing finalization create work for the finalizer thread. If your finalization process is a complex one, the one and only finalizer thread will be spending a lot of time performing those steps, which can cause a backlog of work and therefore cause more objects to linger waiting for finalization. Therefore, it is vitally important that finalizers do as little work as possible. Remember also that although all object pointers remain valid during finalization, it might be the case that those pointers lead to objects that have already been finalized and might therefore be less than useful. It is generally safest to avoid following object pointers in finalization code even though the pointers are valid. A safe, short finalization code path is the best." ---------------------------------------------------------------------- This seems to indiate that if your class has a 'Finalize' method that the memory will not be freed by the GC but will be put in the 'freachable' queue for later treatment and can thus live for a lot longer tha expected and thus still need to hold the memory. Thus my question "To use or not use a Finalize method."
-
A few questions to ask yourself to try and address the problem. 1-What are you using as your datasource:- dataview, dataset/datatable 2-How are you adding the row to your datagrid 3-Have you set the databinding
-
Hi folks, to monitor how mush memory is being used one could follow the use of PerfMon.exe described in the section "Monitoring Garbage Collections" of the article http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/TOC.ASP The outut is hard to follow but may be of some use to people.
-
Hi folks, this is a follow on from the eratic memory thread. I am trying to confirm if using the Finalize method is a good thing or a bad thing. I have a lot of objects in my application and have a Dispose method and a Finalize method in each of them. Now I go to great lenghts to ensure that the Dispose is called for these objects and also setting them to 'Nothing' I have been reading the threads on MSDN http://msdn.microsoft.com/msdnmag/issues/1100/GCI/TOC.ASP http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/TOC.ASP http://msdn.microsoft.com/library/en-us/dndotnet/html/dotnetgcbasics.asp and I take from that that if I am calling my Dispose method that having a Finalize method will block the GC from releasing the memory associated witht he object. Is this right or wrong. :confused:
-
Hi folks, another thing to look out for is that if you declare an object within a method that is only used in that method, the garbage collector does not seem to free it until our application ends, thus beware and tidyup objects/memory as you go. Calling of GC.Collect() as you go han help as well but I have read that it is not always recommended to do that. Does anybodyhave experience with any problems this may cause. Does anybody know if the GC optimizations using generations works as it is supposed to or is it worth the effor if performance is not critical.
-
It is possible to do but you need to creater your own column style and then add a handler and do your own paint method to this to help you format the cell based on the contents on the cell. Look for an example of how to change the color of the text in a box based on the contents, You should be able to build on that to do what you need.
-
Hi folks, does anybody know hot to programatically change the height of an individual row (not the whole table using the preferred height.) in a datagrid. I need to add extra functionality to a paint method and I just can't see what field to get at to set the row height. It has to be possible as using the mouse at runtime one can resize an individual row.
-
You might try the following . If you create your own class and inherit DataGridTextBoxColumn, then overide the paint method and in this work out the length of the text in the cell and if it exceeds the column width then increase the column width appropriately. I think you can get at it in the paint method using Me.DataGridTableStyle.GridColumnStyles(0).Width. Try and see if it works.
-
Hi aewarnick, I have solved this problem by using the re-sizing event and to re-scale the image there. Thanks
-
Hi folks, I have a bit map that is created externally that I want to use as a background image for a button but I want the image to be resized to fill the button space no matter how big the button is. I am currently using the following for putting the image in the button, but the image is either cropped or repeated. Does anybody have an idea how to do this correctly. Thanks for any help Dim strm As System.IO.Stream strm = (Me.GetType.Assembly.GetManifestResourceStream("Project.ButtonStyle1.bmp")) Me.BackgroundImage = New Bitmap(strm) 'CType(strm, System.Drawing.Bitmap) me.Name = "ButtonStyle1" Me.ImageAlign = ContentAlignment.MiddleCenter Me.FlatStyle = FlatStyle.Standard
-
Hi Ariez, have you tried using the DataGridTableStyle. e.g. Dim ts1 As New DataGridTableStyle() ts1.MappingName = "Codes" Dim TextCol3 As New DataGridTextBoxColumn() TextCol3.MappingName = "Code_Field1" TextCol3.HeaderText = "Code1" ts1.GridColumnStyles.Add(TextCol3) ' Add the DataGridTableStyle objects to the collection. dgrid.TableStyles.Add(ts1)
-
Hi folks, that link I posted should be to topic 5.57 How can I place text in the rowheader column of my datagrid? see http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q896q
-
Hi folks, I have managed to solve the row re-size problem by modifiying the "dataGrid1_Paint" part of the sample at http://www.syncfusion.com/FAQ/WinFo..._c44c.asp#q896q I have adjusted it to use the cell location element instead of the ydelta variable to ensure that the text is drawn at the start of the appropriate row, even if the row is re-sized. This means the OnMouseDown/Up methods do not have to be modified. In the example below I have also modified it to display different text based on the contents of cells in the row, this could be changed to suit any different needs. Private Sub dataGrid1_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Dim row As Integer row = TopRow() Dim cm As CurrencyManager cm = CType(Me.BindingContext(Me.dataGrid1.DataSource, Me.dataGrid1.DataMember), CurrencyManager) Do While ((row < cm.Count)) 'get & draw the header text... Dim text1 As String If Len(Trim(Me.dataGrid1(row, 1))) = 2 Or Len(Trim(Me.dataGrid1(row, 1))) = 5 Then text1 = "+/-" Else text1 = "" End If e.Graphics.DrawString(text1, Me.dataGrid1.Font, New SolidBrush(Color.Red), 12, (Me.dataGrid1.GetCellBounds(row, 0).Location.Y)) row = (row + 1) Loop End Sub If anybody has any further/better suggestion on how to do this, please pass them on.
-
Hi Hrabia, I am not too sure what you are talking about here, I need to look at it further. I have found an example at http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q896q that allows me to put text in the header row, but this only paints it at a certain point and is not actually in the row header. If I re-size the rows it does not work. If you have any mor info on your suggestion, pass it on. Slan
-
Hi folks, does anybody know if it is possible or how to change the symbol/add text to the datagrid rowheader. I am not using navigation but I am using filters to modify the data displayed based on the row selected and its contents. I would like to add some more intutive for the user like '+' or '-' or text. Thanks:D
-
Hi folks, does anybody know if it is necessary to pay for a deployment license for Crystal Reports if it is being used within a VS2002 application. Thanks :confused:
-
The PreferredRowHeight will give you bigger boxes but will not give you wordwrap. I have been trying to solve this for a while but havent managed it. I know it works because I have a 3rd party component that does it but I need to be able to do it myself. If you have solved it please let me know.
-
did you find out how to do this yet. I have been searching for a solution to this for a while. It is possible to do as I have found a 3rd party component that does it, but I can not use this as I need to have all the code in my application. If you have solved this please let me know.
-
Hi folks, does anybody know wher I can get information or smaples on the Document Report class. I want to find out if it is easier to use than Crystal Reports. Any help would be great Slan