|
Ill try that, thanks.
http://www.themightyatom.nl
|
|
|
|
|
Just curious...
With New Form1<br />
.Property<br />
.Method<br />
End With
It creates a variable that is automatically released when the "end with" is encountered.
Any known memory leak doing this?
Thanks,
Nathan
|
|
|
|
|
Hi,
AFAIK the With construct is just a shorthand notation, it does not "release" anything,
so if the object needs disposing of closing you should call Dispose() or Close() explicitly
when you no longer need it, to avoid memory leaks.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
in this context it would be "released" because it's a block variable. when the block is done the variable is released. i agree property clean up needs to be done just curious if this something that while dotnet allows isn't handled properly (memory leak).
|
|
|
|
|
No,
(I am assuming the .Method you called is not Close)
once the with block ends, the way you wrote it the object can no longer be accessed
since you don't hold a reference to it, but that does not mean the object also gets
removed from memory at that time; the garbage collector will take care of that at its
leasure, it is allowed to do so immediately but will not do so unless it needs free
memory due to some other request(s). In the mean time any resources (managed or unmanaged)
remain allocated.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I suggest you do some reading on the core of .NET.
Nice to see VB finally has this sort of syntax, it took you guys a while.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm very fimilar with vb so what do you suggest I look at - the 'core' is a little vague.
baby steps baby steps
|
|
|
|
|
Hi Christian,
the with statement "executes a series of statements on a single object" and exists
in VB6 and probably even more ancient versions too, but it does not resemble the
using statement we all enjoy in C#, it is just a shorthand avoiding the repetition
of the object's name in every line, as in
With MyLabel
.Height = 2000
.Width = 2000
.Caption = "This is MyLabel"
End With
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi Nathan,
There's no memory leak in your code. After your code leaves the With block, there are no live references to the Form1 instance, so eventually the garbage collector will kick-in and release both memory & native windows resources associated with the form (.net forms and controls are actually wrappers of native windows resources).
When this collection actually happens, is not under your control, unless you call GC.Collect(); however this is not something recommended since it prevents the garbage collector to self-tune adequately to your application's memory consumption rate - in simpler words - even though by calling GC.Collect() all "releasable" memory is reclaimed and released *at your request*, this is a very expensive operation and in the end you might hurt your application's performance very badly.
However, I would suggest calling .Dispose() before leaving the with block. This way you will be releasing the form's wrapped native windows resources early (something advisable since windows resources are limited). Keep in mind that even if you call Dispose(), the memory held by the Form1 instance will not be freed until the garbage collector runs and reclaims it.
Sincererly I hope I have clarified your doubt and not confused you more.
Gerardo
|
|
|
|
|
|
Hello,
I need a commandbutton that i colored red or green to blink.
Does anyone know how i can do this ?
Is this a standard function in VB 2005.
Thanks
Didier
|
|
|
|
|
|
Use a system timer that changes the color of the button at time intervals you specify.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Can I make a chart in Visual Basic 6 in a form.
What kind of reference must I use?
I don't want to make it myself, I mean drawing it myself.
|
|
|
|
|
leaveu wrote: Can I make a chart in Visual Basic 6 in a form
Yes. But why use VB6, it is pretty dead these days.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi gurus.
I need to create floor map for each (4 floors) floor in my company new building.
Map should be similar to Google maps i.e. when map is viewed (image) I want to show employee names in their cubicles. When specific person is searched I want to show where he seats (just that person). Employee (name) should be tied to Office Communicator (IM), which shows status of the person. I can get employee information from Active Directory (name, title, email, etc.)
Did anyone have any experience doing this? Any help would be greatly appreciated.
If I didn't explain good enough let me know and I will try as best as I can.
Thank you all,
Alex.
|
|
|
|
|
If you cross-post, it's unlikely you're going to get much help
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
This question is for both forums and I don't know how to ask it otherwise.
Instead of just answering the way you did, and wasting your time and mine, you could've answer my question, if you can of course. Then you can let me know that I souldn't have posted it in 2 forums.
Again. I've done it only because I know it can be related to both Forums and I'm not sure people visit both of them like you do.
Thank you,
Alex.
I see that you've posted this response directly to me rather than to the forum.
If you had taken the time to read the forum guidelines, you would know that cross-posting is frowned upon. You shouldn't have to be told this - it's common sense. Cross-posting makes it difficult for people to collaborate on a solution and for other people to find help when searching the forums. I'm not wasting yours or my time by stating this, I'm making you aware of your breach of etiquette. As rule 1 in the forum guidelines states - choose the most appropriate forum for your question and post there only. Your statement that most people don't visit all the forums is irrelevent.
Anyway, what has your question got to do with VB.NET? It's clearly a web development issue.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Yeah. I know it is. But had web questions answered to me in this Forum before. Sometimes you can get a good idea/push from people in here. Sorry for the breach of etiquette. Usually I don't do this. I really need to make my problem work and right now I'm not even sure how to start.
Tanks, Alex.
|
|
|
|
|
I have setup my EXE(it's like a main menu calling other apps or assemblies) to use mutex for checking if another instance of the exe is running...this all works correctly. I have another access point into the mutex logic from the browser -- it runs different logic having the original exe start the requested application. This works correctly 90% of the time. On occasion even though the original exe is running, the TCPChannel will become disconnected -- without explanation. The only location that the actual disconnection logic exists in the code is in the dispose routine. I put logging in there marking sure that routine wasn't being called and it is not.
What is disconnecting the channel? Is there some unknown timeout I didn't notice?
Thanks.
Nathan
-- modified at 14:28 Wednesday 28th November, 2007
|
|
|
|
|
I am saving data automatically each time a user steps off a field. However, if the user wants to exit using the X button and is stepping off an unsaved field to get to the X button the data just entered is disregarded. Stepping off to any other field is no problem...just the X button. Its like once the X button has been keyed then it overrides the leave event (where I am saving the data) to just exit the form.
Any suggestions. I have fiddled with the Form Closing and the Leave event on a datagridview to no avail.
|
|
|
|
|
you want the Form.FormClosing event.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi Luc...This is the first time I've posted here. Thanks for the really fast reply. I'll go back to the FormClosing event and give it another whirl.
|
|
|
|
|
You're welcome.
Wolfpacker wrote: the really fast reply
whatever the day or time, there is always a lot of people around...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Please i can i play sound in vb.net if the sound files are stored in a database.
|
|
|
|