Click here to Skip to main content
15,904,416 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Set Default Download Manager ? Pin
Dan Suthar16-Oct-07 5:55
professionalDan Suthar16-Oct-07 5:55 
QuestionDarkness windows when change the opacity value Pin
haggenx15-Oct-07 6:09
haggenx15-Oct-07 6:09 
AnswerRe: Darkness windows when change the opacity value Pin
Dan Suthar15-Oct-07 6:37
professionalDan Suthar15-Oct-07 6:37 
GeneralRe: Darkness windows when change the opacity value Pin
haggenx16-Oct-07 8:10
haggenx16-Oct-07 8:10 
GeneralRe: Darkness windows when change the opacity value Pin
Dan Suthar16-Oct-07 14:50
professionalDan Suthar16-Oct-07 14:50 
GeneralRe: Darkness windows when change the opacity value Pin
haggenx23-Oct-07 4:47
haggenx23-Oct-07 4:47 
QuestionByRef the ByVal way ?? Pin
barney_197215-Oct-07 4:04
barney_197215-Oct-07 4:04 
AnswerRe: ByRef the ByVal way ?? Pin
Dave Kreskowiak15-Oct-07 6:14
mveDave Kreskowiak15-Oct-07 6:14 
Your code is incorrectly written so it really doesn't matter which one you use. What you've done is definitely bad practice. No, ByVal is not "safer", nor is it "quicker". The two are used for different reasons.

The way you're writing your code, you're writing a function that returns an XmlDocument, the one that's passed in, and you don't have to.

Since you're passing in a Reference type (any class instance), ByVal passes the reference to the object, not the object itself. Passing in an object ByRef passes in a reference to the reference of the object, which doesn't really give you anything. So, since your function is getting a reference to the object on the heap, it can modify that object and not return anything.
Dim XmlDocObject As New XmlDocument
InitializeXml(XmlDocObject)

Private Sub InitializeXml(ByVal xmlDocument As XmlDocument)
    ' Do whatever you need to do to "xmlDocument"
    ' Do not "return" anything since you're modifying
    ' the original object.
End Sub



A guide to posting questions on CodeProject[^]

Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007


GeneralRe: ByRef the ByVal way ?? Pin
barney_197215-Oct-07 21:09
barney_197215-Oct-07 21:09 
QuestionHow do I merge 2 WAV files ? Pin
comtrendz15-Oct-07 3:03
comtrendz15-Oct-07 3:03 
AnswerRe: How do I merge 2 WAV files ? Pin
Guffa15-Oct-07 3:30
Guffa15-Oct-07 3:30 
GeneralRe: How do I merge 2 WAV files ? Pin
lmoelleb15-Oct-07 5:41
lmoelleb15-Oct-07 5:41 
AnswerRe: How do I merge 2 WAV files ? Pin
Benny_Lava16-Oct-07 1:14
Benny_Lava16-Oct-07 1:14 
QuestionCopy files from one folder to another Pin
VB.Net Developer15-Oct-07 2:57
VB.Net Developer15-Oct-07 2:57 
AnswerRe: Copy files from one folder to another Pin
Tamimi - Code15-Oct-07 3:33
Tamimi - Code15-Oct-07 3:33 
AnswerRe: Copy files from one folder to another Pin
Eric Georgiades15-Oct-07 3:36
Eric Georgiades15-Oct-07 3:36 
GeneralRe: Copy files from one folder to another Pin
VB.Net Developer15-Oct-07 3:40
VB.Net Developer15-Oct-07 3:40 
GeneralRe: Copy files from one folder to another Pin
Eric Georgiades15-Oct-07 3:50
Eric Georgiades15-Oct-07 3:50 
GeneralRe: Copy files from one folder to another Pin
VB.Net Developer15-Oct-07 3:53
VB.Net Developer15-Oct-07 3:53 
AnswerRe: Copy files from one folder to another Pin
Abhijit Jana15-Oct-07 4:25
professionalAbhijit Jana15-Oct-07 4:25 
GeneralRe: Copy files from one folder to another Pin
VB.Net Developer16-Oct-07 1:42
VB.Net Developer16-Oct-07 1:42 
QuestionDownload Attachment from Email using VB,NET [modified] Pin
VB.Net Developer15-Oct-07 2:56
VB.Net Developer15-Oct-07 2:56 
AnswerRe: Download Attachment from Email using VB,NET Pin
DigiOz Multimedia15-Oct-07 10:12
DigiOz Multimedia15-Oct-07 10:12 
QuestionWeird memory problem Pin
Skippy II15-Oct-07 2:47
Skippy II15-Oct-07 2:47 
AnswerRe: Weird memory problem [modified] Pin
Dave Kreskowiak15-Oct-07 6:08
mveDave Kreskowiak15-Oct-07 6:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.