Troubleshooting File Copying and Removing Items in Visual Basic Function

  • Thread starter Thread starter phion
  • Start date Start date
  • Tags Tags
    File Visual
AI Thread Summary
The discussion revolves around troubleshooting a Visual Basic function designed to copy the contents of a file while removing a specified item from a list. The user is experiencing issues where the function does not correctly exclude the desired item, often resulting in the last item being deleted instead. Suggestions include ensuring case insensitivity and trimming whitespace during string comparisons, as well as adjusting the loop to start from zero instead of one. The code logic is clarified, emphasizing that the removePlayer function should process the existing array rather than reading the file again. The conversation highlights the need for precise debugging to identify why the function behaves unexpectedly.
  • #51
Samy_A said:
No problem. Just try to be systematic in your work.
I appreciate the guidance.
 
Technology news on Phys.org
  • #52
Ok, it works now. Duh.
 
  • #53
Samy_A said:
EDIT: Apparently, when you pass an array as argument (even as ByVal), you can still modify the array element apparently.
Yes, that is true. My post #42 is incorrect. ByVal only applies to value types. Arrays are reference types. And I guess it's a good thing because it would be pretty inefficient to copy an entire array and all it's elements every time you passed it as an argument.
 
Back
Top