4
Answers

Accessory for FileDialog

neil 0

neil 0

21y
1.7k
1
Is it possible to add an accessory to a FileDialog like a thumbnail preview, Panel, TextBox etc? I know Java's JFileChooser can do it so I assume C# can too. Thanks. Neil
Answers (4)
0
saphiroth42

saphiroth42

NA 53 0 20y
It seems to work very well. I hope there will to no side affects from this. Thanks a lot.
0
vidhya_bala2003

vidhya_bala2003

NA 20 0 20y
Hi saphiroth, Actually i also had the same problem. My project is heavier, having more than 110 forms. I also in search of a solution for more than 1 month. i have tried various methods but in vain. At last i tried this mtd and i haven't experienced any performance degrade by using this method. Try out and tell if u face any problem. Chk out this url for more info http://addressof.com/blog/archive/2003/11/19/281.aspx
0
saphiroth42

saphiroth42

NA 53 0 20y
Again I want to say thanks. How did u find this method? Is it safe to use through out every form? What I did is make a new class and put that function in the class. So I create an instance of the class and call this function to clear out RAM. I hope this is ok to do.
0
saphiroth42

saphiroth42

NA 53 0 20y
nevermind, I read up on the SetProcessWorkingSetSize. Thank you for your help.
0
saphiroth42

saphiroth42

NA 53 0 20y
I don't clearly understand what this does or how it works. How does it help memory management?
0
vidhya_bala2003

vidhya_bala2003

NA 20 0 20y
Have you tried using the SetProcessWorkingSetSize Win32 API Function Form1.vb Private Sub Buttonopen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim frm2 As New Form2() frm2.MdiParent = Me frm2.Dock = DockStyle.Fill frm2.Show() frm2.BringToFront() End Sub Form2.vb Private Declare Function SetProcessWorkingSetSize Lib "kernel32.dll" (ByVal hProcess As IntPtr, ByVal dwMinimumWorkingSetSize As Int32, ByVal dwMaximumWorkingSetSize As Int32) As Int32 Public Function SaveMemory() As Int32 Return SetProcessWorkingSetSize(Diagnostics.Process.GetCurrentProcess.Handle, -1, -1) End Function 'Form Close Private Sub Buttonclose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCancel.Click SaveMemory() Me.Close() End Sub
0
MythicalMe

MythicalMe

NA 245 0 20y
Not necessarily. Garbage collection occurs when an object tries to allocate memory for a new object and the heap has no free memory. So memory allocated may not be collected if the apllication doesn't create many objects. Further, it can take up to two collection cycles before an object's memory allocation is actually released back to the pool. When memory is collected the object's Finalize method is called, and then the collector frees the memory. If you need to get memory back to the heap faster you can call GC.Collect yourself. If you do so, you should follow it up with a GC.WaitForPendingFinalizers call. There is a slight performance hit in doing this.