|
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.
|
|
|
|
|
Wun'nam wrote: can i play sound in vb.net if the sound files are stored in a database
Yes, you can. You'll have to save the sound file as a binary type, and pull it out and work some magic
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I am creating a windows application using vb .net 2005 and sql server 2005.
i want to print a local (embedded) rdlc report without showing it.
is it possible?
if not, then how do i print the report (displayed in reportiviewer) without showing print dialog.
Thank you.
|
|
|
|
|
i want to scan and save the image file created from my application from the scanner output..provide me with TWAIN.dll along with code or some code to do that...i also want to save it with the file name i give and the path of it...can anyone do that
thanks
drink whisky save water
|
|
|
|
|
Hi Niraj
Bellow is the code for scanning a document from a scanner attached to the system. You have to reference the a file 'wiaaut.dll' which u can get from the internet.
Enjoy scanning without drivers loaded.
Imports System.Reflection
Imports Microsoft.Win32
Imports WIA
'Inside the Scan Button write the codes below.
Dim Dlg1 As New WIA.CommonDialog
Dim Scanner1 As WIA.Device
Dim Img As WIA.ImageFile
Scanner1 = Dlg1.ShowSelectDevice(WIA.WiaDeviceType.ScannerDeviceType, False, False)
Img = Scanner1.Items(1).Transfer
Img.SaveFile(strpathandfilename)
Sekhar
|
|
|
|
|
I dont understand enumerators. Why are they used instead of normal variables...there has to be a benifit? What exactly are they? Does anyone know how to break this topic down for me...i searched MSDN2 and that was way over my head. I just need to know what they are and what are the rules and reasons that they are used. Any help would be great
Erica
|
|
|
|
|
imonfiredammit wrote: I dont understand enumerators. Why are they used instead of normal variables
Enumerators are just objects, just like normal variables are objects.
imonfiredammit wrote: there has to be a benifit? What exactly are they?
They limit the range of possible values that can be assigned to a variable with the specified enumerator's type.
imonfiredammit wrote: Does anyone know how to break this topic down for me...
Can I suggest chapter 9 of Microsoft Visual C# 2005 Step-by-step
Oops! Just realised this is the VB.NET forum. There is an equivalent book for VB.NET.
|
|
|
|
|
Colin Angus Mackay wrote: Enumerators are just objects, just like normal variables are objects.
Hi Colin, well, actually not all normal variables are objects. An integral type (Int16, Int32, etc.. ) is a value type, and it is not stored as an object (reference type) UNLESS it is needed to. It all depends on your code's syntax.
This automatic conversion between value types and reference types is managed transparently by the .net platform by means of two behind-the-scenes processes known as "boxing" and "unboxing" respectively.
Boxing implies first creating on the heap a new instance of an object "compatible" with the original value type (involving dynamic memory allocation) then the actual variable's value must be copied to this new instance.
Unboxing implies dereferencing the value stored in an object instance and convert it back to a value-type.
Dim o as Object
Dim n as Integer
Dim m as Integer
Dim al as New ArrayList
o = 5 ' the value 5 is converted to an object (boxing) before being assigned
n = 0 ' the object's value 5 is dereferenced and stored back in n as a type value (unboxing)
' This means that n holds a copy of the value stored in o (5) not an extra reference to the same object refered by o
m = 10 ' The value 10 is directly stored in variable m as a value type, no heap memory allocation has taken place
al.Add(m) ' The variable m is converted to an object (boxed) before being added to the collection
Some languages like C++ can't treat integral types as objects for the sake of efficiency, other languages like Smalltalk effectively treat every variable (even integral types) as objects, which results in memory allocation/deallocation overhead for every single variable. The .net platform gives you the best of both worlds: on most cases, integral variables will be treated as efficiently as C++'s integral variables, but if needed to, they will be *transparently* converted to an object by the automatic "boxing-unboxing" process, giving you the full benefits of object orientation.
Cheers,
Gerardo
An interesting form of object-oriented programming:
You suggest a novel algorithm, and watch as the rest of your team objects!
|
|
|
|