Click here to Skip to main content
15,913,467 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: how to display files that are not in directory? Pin
zaimah4-Jan-09 2:39
zaimah4-Jan-09 2:39 
GeneralRe: how to display files that are not in directory? Pin
Luc Pattyn4-Jan-09 6:03
sitebuilderLuc Pattyn4-Jan-09 6:03 
QuestionRe: how to display files that are not in directory? Pin
zaimah8-Jan-09 20:31
zaimah8-Jan-09 20:31 
AnswerRe: how to display files that are not in directory? Pin
Luc Pattyn9-Jan-09 1:21
sitebuilderLuc Pattyn9-Jan-09 1:21 
GeneralRe: how to display files that are not in directory? Pin
zaimah11-Jan-09 14:35
zaimah11-Jan-09 14:35 
GeneralRe: how to display files that are not in directory? Pin
Luc Pattyn11-Jan-09 15:22
sitebuilderLuc Pattyn11-Jan-09 15:22 
GeneralRe: how to display files that are not in directory? Pin
zaimah11-Jan-09 16:14
zaimah11-Jan-09 16:14 
GeneralRe: how to display files that are not in directory? Pin
Luc Pattyn11-Jan-09 16:45
sitebuilderLuc Pattyn11-Jan-09 16:45 
Hi,

1.
if File.Exists(file)=False then can/should be written as if NOT File.Exists(file) then , that is what I meant, this is not a mistake just a comment on style.

2.
I guess you are using relative paths, your text boxes just contain FTP and PORTAL, instead of
C:\Documents and Settings\Desktop\FTP and C:\Documents and Settings\Desktop\PORTAL

Now assume one of your files inside FTP is ...\FTP\FTP1.DAT, then String.Replace("FTP", "PORTAL") would turn that into ...\PORTAL\PORTAL1.DAT which is not what you intend;
Replace does not care about folders and filenames, it just eagerly replaces.
That is way I suggested not using Replace, but performing a string concatenation; this only
works if the paths are absolute, i.e. the thing to be replaced starts at the first character
(replace C:\Documents and Settings\Desktop\FTP by C:\Documents and Settings\Desktop\PORTAL)

3.
a general debugging rule:
as long as your code does not behave the way you want, split a more complex line in multiple lines and
watch the intermediate values, like so:
...
dim filename2 as string=filename.Replace(AFolder,BFolder)
Console.WriteLine("--- Going to look if this exists: "&filename2)
if not File.Exists(filename2) then
...


That way you will see whether or not you are checking the right filenames, or are having some
trouble with paths and/or replace issues.

Of course you can use myListBox.Add() or whatever you prefer to see intermediate values...
listing them to a console or listbox is much easier than watching them through debug commands
or through MessageBox.Show statements (they get irritating pretty soon).

4.
your code ran fine with me when the textboxes contained "H:\someFolder\" and "H:\someFolderCopy\";
it discovered 2 files missing out of several thousand.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

I use ListBoxes for line-oriented text, and PictureBoxes for pictures, not drawings.


GeneralRe: how to display files that are not in directory? Pin
zaimah11-Jan-09 17:26
zaimah11-Jan-09 17:26 
GeneralRe: how to display files that are not in directory? Pin
Luc Pattyn11-Jan-09 18:32
sitebuilderLuc Pattyn11-Jan-09 18:32 
GeneralRe: how to display files that are not in directory? Pin
zaimah11-Jan-09 21:14
zaimah11-Jan-09 21:14 
GeneralRe: how to display files that are not in directory? Pin
Luc Pattyn12-Jan-09 2:24
sitebuilderLuc Pattyn12-Jan-09 2:24 
QuestionRetrieve last ID from SQl server Pin
Jodd2-Jan-09 13:15
Jodd2-Jan-09 13:15 
AnswerRe: Retrieve last ID from SQl server Pin
Mycroft Holmes2-Jan-09 15:35
professionalMycroft Holmes2-Jan-09 15:35 
AnswerRe: Retrieve last ID from SQl server Pin
N a v a n e e t h2-Jan-09 15:51
N a v a n e e t h2-Jan-09 15:51 
AnswerRe: Retrieve last ID from SQl server Pin
TheComputerMan3-Jan-09 4:44
TheComputerMan3-Jan-09 4:44 
AnswerRe: Retrieve last ID from SQl server Pin
TheComputerMan3-Jan-09 4:49
TheComputerMan3-Jan-09 4:49 
QuestionLost Feature in VB Pin
udatl2-Jan-09 10:57
udatl2-Jan-09 10:57 
AnswerRe: Lost Feature in VB Pin
Fabio V Silva2-Jan-09 12:04
Fabio V Silva2-Jan-09 12:04 
GeneralRe: Lost Feature in VB Pin
udatl2-Jan-09 16:25
udatl2-Jan-09 16:25 
GeneralRe: Lost Feature in VB Pin
TheComputerMan3-Jan-09 4:28
TheComputerMan3-Jan-09 4:28 
QuestionWant to add a comboboxcolumn runtime and pass value to the comboboxcolumn runtime Pin
Nattumakkan2-Jan-09 5:37
Nattumakkan2-Jan-09 5:37 
AnswerRe: Want to add a comboboxcolumn runtime and pass value to the comboboxcolumn runtime Pin
TheComputerMan2-Jan-09 6:46
TheComputerMan2-Jan-09 6:46 
AnswerRe: Want to add a comboboxcolumn runtime and pass value to the comboboxcolumn runtime Pin
dan!sh 2-Jan-09 8:26
professional dan!sh 2-Jan-09 8:26 
QuestionFile in use error Pin
TheComputerMan2-Jan-09 5:04
TheComputerMan2-Jan-09 5:04 

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.