Click here to Skip to main content
15,910,471 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: MDI children w/progress bars not asynchronously updating Pin
Wayne Gaylard5-Feb-10 17:25
professionalWayne Gaylard5-Feb-10 17:25 
QuestionKeypress Event Double Firing Pin
eddieangel5-Feb-10 13:07
eddieangel5-Feb-10 13:07 
AnswerRe: Keypress Event Double Firing Pin
Luc Pattyn5-Feb-10 13:21
sitebuilderLuc Pattyn5-Feb-10 13:21 
Questiongood coding practices? Pin
kmas37525-Feb-10 8:26
kmas37525-Feb-10 8:26 
AnswerRe: good coding practices? [modified] Pin
Ray Cassick5-Feb-10 8:59
Ray Cassick5-Feb-10 8:59 
AnswerRe: good coding practices? Pin
MicroVirus5-Feb-10 11:26
MicroVirus5-Feb-10 11:26 
AnswerRe: good coding practices? Pin
DaveAuld5-Feb-10 20:10
professionalDaveAuld5-Feb-10 20:10 
AnswerRe: good coding practices? Pin
William Winner8-Feb-10 9:44
William Winner8-Feb-10 9:44 
Method 2 is definitely not preferred. Return is standard for C anything and it's very nice that VB.Net now lets you return instead of setting the function name to the value or object.

With Try/Catch segments, I always just put the one line that could cause an exception. I would go with:

VB
Public Function ByteArrayToStream(ByRef byteIn() as Byte) as System.IO.MemoryStram
    If byteIn Is Nothing Then Return Nothing

    Try
        Return New System.IO.MemoryStream(byteIn, True)
    Catch ex as Exception
        Return Nothing
    End Try
End Function


You want to avoid using extra memory. Option 3 uses extra memory by creating a new variable. Granted, it's really only a placeholder...a single address in memory pointing to the actual object, but it's still something. Personally, I think #1 is fine. I would assume that the IO.MemoryStream function first checks to see if there was anything actually passed in, so you could probably get rid of the If byteIn Is Nothing section.
QuestionTaking Screen Shots of PPC Apps Pin
Dominick Marciano5-Feb-10 7:31
professionalDominick Marciano5-Feb-10 7:31 
AnswerRe: Taking Screen Shots of PPC Apps Pin
Smithers-Jones5-Feb-10 12:57
Smithers-Jones5-Feb-10 12:57 
GeneralRe: Taking Screen Shots of PPC Apps Pin
Dominick Marciano6-Feb-10 12:11
professionalDominick Marciano6-Feb-10 12:11 
QuestionHide source code of application Pin
Gagan.205-Feb-10 2:20
Gagan.205-Feb-10 2:20 
AnswerRe: Hide source code of application Pin
Nuri Ismail5-Feb-10 3:14
Nuri Ismail5-Feb-10 3:14 
GeneralRe: Hide source code of application Pin
Gagan.205-Feb-10 3:59
Gagan.205-Feb-10 3:59 
QuestionDifferentiate between a database connection problem and database read problem Pin
Wayne Gaylard5-Feb-10 1:11
professionalWayne Gaylard5-Feb-10 1:11 
AnswerRe: Differentiate between a database connection problem and database read problem Pin
David Skelly5-Feb-10 1:59
David Skelly5-Feb-10 1:59 
GeneralRe: Differentiate between a database connection problem and database read problem Pin
Wayne Gaylard5-Feb-10 3:13
professionalWayne Gaylard5-Feb-10 3:13 
QuestionUpdate VB.NET Windows application ! Pin
jeshra2795-Feb-10 0:44
jeshra2795-Feb-10 0:44 
AnswerRe: Update VB.NET Windows application ! Pin
Dave Kreskowiak5-Feb-10 2:17
mveDave Kreskowiak5-Feb-10 2:17 
QuestionTemporary Files Location Pin
Anubhava Dimri5-Feb-10 0:32
Anubhava Dimri5-Feb-10 0:32 
AnswerRe: Temporary Files Location Pin
Nuri Ismail5-Feb-10 0:42
Nuri Ismail5-Feb-10 0:42 
GeneralRe: Temporary Files Location Pin
Anubhava Dimri5-Feb-10 1:24
Anubhava Dimri5-Feb-10 1:24 
GeneralRe: Temporary Files Location Pin
Dave Kreskowiak5-Feb-10 2:14
mveDave Kreskowiak5-Feb-10 2:14 
AnswerRe: Temporary Files Location Pin
DaveAuld5-Feb-10 1:08
professionalDaveAuld5-Feb-10 1:08 
GeneralRe: Temporary Files Location Pin
Steven J Jowett5-Feb-10 1:20
Steven J Jowett5-Feb-10 1:20 

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.