Click here to Skip to main content
15,895,142 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: VB.Net Compiler Warning.......'used before assigned a value. null exception could result'. Pin
DaveAuld29-May-09 2:03
professionalDaveAuld29-May-09 2:03 
GeneralRe: VB.Net Compiler Warning.......'used before assigned a value. null exception could result'. Pin
Luc Pattyn29-May-09 2:05
sitebuilderLuc Pattyn29-May-09 2:05 
AnswerRe: VB.Net Compiler Warning.......'used before assigned a value. null exception could result'. Pin
chilinhhacker14-Jul-09 16:03
chilinhhacker14-Jul-09 16:03 
QuestionVB6 application using BeforeNavigate2 to capture a filled web page no longer catching pop-ups Pin
hubdawgs28-May-09 17:00
hubdawgs28-May-09 17:00 
AnswerRe: VB6 application using BeforeNavigate2 to capture a filled web page no longer catching pop-ups Pin
Christian Graus28-May-09 21:18
protectorChristian Graus28-May-09 21:18 
GeneralRe: VB6 application using BeforeNavigate2 to capture a filled web page no longer catching pop-ups Pin
hubdawgs29-May-09 4:06
hubdawgs29-May-09 4:06 
QuestionFTP Download problems Pin
CodecCodes28-May-09 15:32
CodecCodes28-May-09 15:32 
AnswerRe: FTP Download problems Pin
Dave Kreskowiak28-May-09 17:33
mveDave Kreskowiak28-May-09 17:33 
First, you might want to put something inside the Catch x As Exception blocks so you can see the errors you're getting instead of swallowing them without a trace.

Just a quick glance and I can tell you that the paths you're using are illegal. You're doing this:
If File.Exists("C:\Documents and Settings\user\My Documents\My Received Files" & filename) Then
    File.Delete("C:\Documents and Settings\user\My Documents\My Received Files" & filename)
End If
'---create the file
fs = New System.IO.FileStream("C:\Documents and Settings\user\My Documents\My Received Files" & filename...

Which will result in a path that looks like this:
C:\Documents and Settings\user\My Documents\My Received FilesSomeFileName.Ext

See something wrong with that path?? I can see three things at a minimum. First, the user better be a legal user name. I hope you're replacing that with the real user name. Second, your code doesn't put a backslash between the end of the directory chain and the filename you appended to it. Third, you shouldn't be building paths with hard-coded path information. You should be using the Path class to build that paths and the Environment class to get the current users profile path. Also, you might want to just build the path once and reuse the variable holding it instead of building the path multiple times.
Private Const FileStoreFolderName As String = "My Received Files"
...
Dim filename As String ' (this should be set to something prior to this code)
Dim userDocumentsPath As String = Environment.GetFolderPath(Environment.MyDocuments)

' This code broken out for clarity
Dim fullReceiveFilePath As String
fullReceiveFilePath = Path.Combine(userDocumentsPath, FileStoreFolderName)
fullReceiveFilePath = Path.Combine(fullReceiveFilePath, filename)

There's a ton of other things wrong with the code, but this is the most glaring. For example, just above this code in your snippet, you (attempt) to get an IPAddress, but you never use it in the rest of the code.


A guide to posting questions on CodeProject[^]



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




Questionworksheetfunction.match Pin
yamanbas28-May-09 8:41
yamanbas28-May-09 8:41 
QuestionGet data off a grid on a web page Pin
MarDude28-May-09 5:54
MarDude28-May-09 5:54 
AnswerRe: Get data off a grid on a web page Pin
Jay Royall28-May-09 6:14
Jay Royall28-May-09 6:14 
GeneralRe: Get data off a grid on a web page Pin
MarDude28-May-09 7:11
MarDude28-May-09 7:11 
GeneralRe: Get data off a grid on a web page Pin
Jay Royall28-May-09 8:22
Jay Royall28-May-09 8:22 
GeneralRe: Get data off a grid on a web page Pin
MarDude28-May-09 13:33
MarDude28-May-09 13:33 
GeneralRe: Get data off a grid on a web page Pin
Jay Royall28-May-09 22:01
Jay Royall28-May-09 22:01 
GeneralRe: Get data off a grid on a web page Pin
MarDude29-May-09 6:48
MarDude29-May-09 6:48 
QuestionHow to Create a Dynamic Page in VB and Print the same. Pin
Kaushal Arora28-May-09 1:55
Kaushal Arora28-May-09 1:55 
AnswerRe: How to Create a Dynamic Page in VB and Print the same. Pin
Dave Kreskowiak28-May-09 6:44
mveDave Kreskowiak28-May-09 6:44 
GeneralRe: How to Create a Dynamic Page in VB and Print the same. Pin
Kaushal Arora28-May-09 17:47
Kaushal Arora28-May-09 17:47 
GeneralRe: How to Create a Dynamic Page in VB and Print the same. Pin
DidiKunz28-May-09 23:14
DidiKunz28-May-09 23:14 
QuestionHow to connect the sql sever to pda device. Pin
PandiaRajan_P28-May-09 1:49
PandiaRajan_P28-May-09 1:49 
AnswerRe: How to connect the sql sever to pda device. Pin
Dave Kreskowiak28-May-09 4:25
mveDave Kreskowiak28-May-09 4:25 
Questioncrysatl report for ms access Pin
hrishiS27-May-09 23:33
hrishiS27-May-09 23:33 
QuestionSend SMS from a VB6 Application Pin
she-Developer27-May-09 21:42
she-Developer27-May-09 21:42 
AnswerRe: Send SMS from a VB6 Application Pin
Baran M28-May-09 0:59
Baran M28-May-09 0:59 

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.