|
Well, I played with ClickOnce for a little bit. It doesn't look like you can add the extra file. I actually have no idea if you can or can't. I don't use ClickOnce for any of my deployments.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Is there a way to make all children forms see the MDI left as anything other than 0. For instance if I wanted to make all child forms left=150, is there a way to set a property of the MDI form to 150.
|
|
|
|
|
'routine in the mdi
Sub ChangeLocation(iLeft as int16)
For Each ChildForm As Form In Me.MdiChildren
ChildForm.left = iLeft
Next
end sub
|
|
|
|
|
Is there a way to make all children forms see the MDI left as anything other than 0. For instance if I wanted to make all child forms left=150, is there a way to set a property of the MDI form to 150.
|
|
|
|
|
Nope. You can change the left edge of the MdiClient control that your child forms are rendered in though. Search the MDI Parent forms Control container for the only control that is an MdiClient. You can then make anyn changes you want to it, just like any other control you drag and drop on the form. By default, the MdiClient is Docked to Fill the form it's on, so in order to change it's location, you'll have to set it's Dock property to None. Then you'll be able to change Location and Size properties.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have been looking around the net and the examples are so generic I am having trouble following them. I have taken over code that contains a class that calls .NET Interop code, so this is present.
<br />
Public Class ClassName<br />
Implements System.IDisposable<br />
<br />
Public Sub Dispose() Implements System.IDisposable.Dispose<br />
<br />
End Sub<br />
That is it in terms of the Dispose code in the class. What do I need to add to this to make it useful and do I need it at all?
Thanks,
Cleako
|
|
|
|
|
this is good information:
http://www.codeproject.com/useritems/idisposable.asp
|
|
|
|
|
Man, I do alot of coding but when it comes to the Dispose calls I just dont get it. That page is like a math book giving an example of an equation such as y=2x+b then the 1st problem you get is 2-y=x^81 + b/4 or some other nonsense.
In other words that sounds great and I get when to put object.Dispose but I guess Im unsure what objects require a Dispose call and which ones dont and when do I actually call Dispose and when does the code do it for me?
Cleako
|
|
|
|
|
If the Dispose method is empty, you don't need it. Dispose is used when an object needs to clean up resources, like unmanaged file handles and such or managed objects that your object holds onto that don't clean themselves up, like a Graphics object. You put the code in the Dispose method that cleans these "loose ends" up before your object is destroyed.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
cleako wrote: I guess Im unsure what objects require a Dispose call
Any objects that hold resources of significant size, or resources that are unmanaged ( such as GDI handles )
cleako wrote: when do I actually call Dispose
That bit is easy - when you are about to lose access to an object, either because it's a local variable, or you're about to change the value ( or, you may set a value to null after calling Dispose on the basis that you don't need it anymore )
cleako wrote: when does the code do it for me?
Never. The code will call Finalise when it finally GCs the object. I don't think that Dispose is ever called by the framework. Really, your code should use finalise as well, and clean up anything there that was not Dispose'd of.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I used to call .Dispose on objects all the time then I asked a trainer about it and they made it sound like I was doing too much. So 2 more questions then.
What is a good resource other than that page I was pointed to read up on this stuff and when should I do something like .Dispose and when should I do something like Implements IDisposable etc...?
Cleako
|
|
|
|
|
As a general rule of thumb, you call .Dispose on object that implement it.
You implement IDisposable on your own object when they have resources that you need to specifically release when your done with them.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
rules to live by:
1) if an object has a dispose method, you should ALWAYS call it or bad things like memory leaks can occur
2) "try" to never rely on vb to clean up your objects for you.
3) add a dispose method to your classes and call it to safely release(close,dispose,nothing) all of your objects.
4) in routines, try to utilize they key word "using" which is supposed to guarantee (according to the help file) proper release of memory that your object was taking up.
|
|
|
|
|
So if I have a class for DataAccess and I call it just to make the connection and return a dataset, should I also have a .Dispose in that class that disposes of the Connection Object everytime and any data adapters etc...?
Cleako
|
|
|
|
|
You should be closing your database connection when you're done with the SQL query. NEVER hold open an SQL connection longer than is absolutely necessary. SQL server licenses are expensive. Holding a connection open for the life of your application hogs that license so no other application can use it when you're not using it. Remember, Windows and Servers are SHARED resources, so you have to write your code to work and play nice with others.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Oh no, dont mark me as a bad coder! I wont be able to answer questions in good conscience again! I always close the connection in the Finally block after I use it. What I was asking as an example are what objects in that class are "Disposable"? Would I not only call a CN.Close but also a CN.Dispose? I think you can call a StreamReader.Close/Flush/Dispose.
So the path that got me to where I am right now is I havent used Implements IDisposable before. I also lost touch with my .Dispose self somewhere along the line and I guess I need to get back in touch with it.
The code I have "inherited" implements the IDisposable in a data access class. I dont know why but it does. The information I have read about Implements IDisposable makes it sound as if you only call that with COM objects, COM wrappers, unmanaged code calls, etc... Im trying to figure out the boundary of crazy "Disposing" and necessary "Disposing"
Thanks!!
Cleako
|
|
|
|
|
cleako wrote: Im trying to figure out the boundary of crazy "Disposing" and necessary "Disposing"
Add to your list that you should implement and call dispose on any class that holds on to an object that implements IDisposable as well. For example:
Class A implements IDisposable.
Class B holds a reference to an instance of class A as a field (member variable)
Class B needs to implement IDisposable because it holds an object of class A.
The Dispose method on class B calls the Dispose method on class A.
Also remember to implement a Finalizer method that calls Dispose on any class that implements it. This is to ensure that any object that is being garbage collected by the system and implements Dispose actually gets disposed. It is a final safe guard against accidentally holding on to things that should have been released. Once the object is garbage collected nothing can release the resource. This causes your application to leak memory, use up resources and eventually implode under its own weight.
|
|
|
|
|
When I minimize a child form in VB.Net it always goes to the bottom left corner. when I try to reference it from the parent and move it to the right some it just sits there, it seems like there is a property holding it. When minimized I can take my mouse and move the minimized form and it will then open and minimized to that location. Any help will be appriciated.
|
|
|
|
|
try ChildForm.SetBounds(300, 300, 0, 0)
|
|
|
|
|
that is only changing the form when it is restored, not the minimized title bar part.
|
|
|
|
|
i couldn't find a way to do what you asked about so by using this technique you can "simulate a minimize" by setting the size to 0,0 which will allow you to control the location.
in the form's resize event check if the windowstate = minimize and if it is, set the window state to normal then use the setbound to shrink it and to place it where you want. (just an idea)
|
|
|
|
|
Can anyone tell me how to use a command button to change the font of the writing on a form and another button to change the colour of the font on the form?
Using: Visual Basic.net 2002
Thank you!
-- modified at 12:48 Monday 8th January, 2007
|
|
|
|
|
1) your obviously are going to be dealing with the click events of both buttons
2) are you hard coding the font or do you want the "wizards" to pop-up and let them choose?
|
|
|
|
|
I would like the wizards to pop up and to let them choose as long i can change both font and colour
|
|
|
|
|
Ex:
'font
Me.Font = New System.Drawing.Font("GeoSlab703 Lt BT", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
'color
Me.ForeColor = System.Drawing.Color.Red
use the 'font dialog' control and 'color dialog' control from the toolbox to allow the user to choose...
|
|
|
|