הבהרה /תיקון..
מצורפים לכאן שתי מקורות עם הסברים וטריקים.. 1. לגבי ה CONNECTION...מסכים בהחלט..ואין מה להוסיף הכל כמובן בהתאם לצרכים 2. כנ"ל גם לגבי השאר.. לגבי BYVAL BYREF.....עשיתי כאן איזה שהוא בלבול קטן.. ב VB במילא אי אפשר להעביר דברים גדולים - מערכים וכו´ BYVAL כך שהבעייה שהעלה ANTIDOT..פחות בעייתית.. התשובה הנכונה היא שבמשתנים קטנים עדיף להעביר BYVAL כנורמה תכנותית נכונה (על מנת שלא תשנה את ערכו- ראה קישורים) ואיילו מידע גדול יש בהחלט להעביר BYREF..... וכך אני מתיישר עם דבריו של ANTIDOT ומצרף זר של התנצלויות באם גרמתי לבלבול... קישורho: http://www.aivosto.com/vbtips/vbtips.html http://support.microsoft.com/support/kb/articles/q73/7/98.asp ציטוט מתוך ספר - PRACTICAL STANDARDS FOR MS VB בהוצאת MS .שנת 2000 Pass data ByVal or ByRef, as appropriate. Visual Basic passes data to procedure parameters by reference unless told to do otherwise. When a variable is passed by reference (ByRef) to a parameter of a procedure, the procedure receives a pointer to the original variable. Any subsequent changes made to the parameter are made to the original variable. On the other hand, when a variable is passed by value (ByVal) to a parameter, the procedure receives a copy of the variable. (String variables are an exception to this rule.) Any changes made to the parameter are made only to the copy, and the original variable remains unchanged. One possible standard would be to preface each parameter with ByRef or ByVal. That way you´re explicitly declaring which process to use, and the code is more self-documenting. However, the discipline required to preface every parameter with ByRef or ByVal is great. Another, and definitely easier, solution is to preface a parameter with ByRef only when that parameter will be used to change the value of the original variable (also called the argument). In that case, this practical application would read, "When a parameter is used to change the value of its argument, explicitly declare the parameter as ByRef." Then you can add a comment to the Accepts section of the procedure comment header stating that the parameter is being used as an output parameter—that is, to change the value of its argument. This approach gives you the best of both worlds.
מצורפים לכאן שתי מקורות עם הסברים וטריקים.. 1. לגבי ה CONNECTION...מסכים בהחלט..ואין מה להוסיף הכל כמובן בהתאם לצרכים 2. כנ"ל גם לגבי השאר.. לגבי BYVAL BYREF.....עשיתי כאן איזה שהוא בלבול קטן.. ב VB במילא אי אפשר להעביר דברים גדולים - מערכים וכו´ BYVAL כך שהבעייה שהעלה ANTIDOT..פחות בעייתית.. התשובה הנכונה היא שבמשתנים קטנים עדיף להעביר BYVAL כנורמה תכנותית נכונה (על מנת שלא תשנה את ערכו- ראה קישורים) ואיילו מידע גדול יש בהחלט להעביר BYREF..... וכך אני מתיישר עם דבריו של ANTIDOT ומצרף זר של התנצלויות באם גרמתי לבלבול... קישורho: http://www.aivosto.com/vbtips/vbtips.html http://support.microsoft.com/support/kb/articles/q73/7/98.asp ציטוט מתוך ספר - PRACTICAL STANDARDS FOR MS VB בהוצאת MS .שנת 2000 Pass data ByVal or ByRef, as appropriate. Visual Basic passes data to procedure parameters by reference unless told to do otherwise. When a variable is passed by reference (ByRef) to a parameter of a procedure, the procedure receives a pointer to the original variable. Any subsequent changes made to the parameter are made to the original variable. On the other hand, when a variable is passed by value (ByVal) to a parameter, the procedure receives a copy of the variable. (String variables are an exception to this rule.) Any changes made to the parameter are made only to the copy, and the original variable remains unchanged. One possible standard would be to preface each parameter with ByRef or ByVal. That way you´re explicitly declaring which process to use, and the code is more self-documenting. However, the discipline required to preface every parameter with ByRef or ByVal is great. Another, and definitely easier, solution is to preface a parameter with ByRef only when that parameter will be used to change the value of the original variable (also called the argument). In that case, this practical application would read, "When a parameter is used to change the value of its argument, explicitly declare the parameter as ByRef." Then you can add a comment to the Accepts section of the procedure comment header stating that the parameter is being used as an output parameter—that is, to change the value of its argument. This approach gives you the best of both worlds.