Application only crashes on a few system

G

Guest

Hi all,

I have created a VB.net application using:
Microsoft Development Environment 2002 Version 7.0.9466
Microsoft .NET Framework 1.0 Version 1.0.3705

The application was working fine in one system but crashes on the other.
1) Functioning PC
OS :Window XP service pack 1, Version 1 (Build 2600.xpsp2.030422-1633)
..Net : Version V1.1.4322

2) Not Functioning PC
OS :Window XP service pack 1, Version 1 (Build 2600.xpsp2_gdr.040517-1325)
..Net : Version V1.1.4322

Any suggestion on what could be the problem?
What other information do I need to pinpoint where could be the problem?
Is it because of the XP service pack version? I can find any information
regarding the different build information.

Thanks,
Wong
 
G

Guest

The error msg is as follows:

System.IO.IOException: Bad file name or number
at Microsoft.VisualBasic.FileSystem.PrintLine(Int32 FileNumber, Object[]
Output)
at FileComparator.Selection.Button_start_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
..........
 
C

Cor Ligthert

Wong,

The only thing I can come up from this information and because of the
different versions, (I don't know if that is for language types), that it
can be that the computers have different country settings and that you have
hard coded stringsformat which you use as filenames.

However can maybe show the code where that io operation is done where it
crashes?

Cor
 
G

Guest

Hi Cor,

Thanks for the reply.
Here are some of the codes which might be causing the problem.

Private Sub Button_start_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button_start.Click
Dim filename, filename2 As String
Dim file1, file2 As String
Dim startcheck As Boolean

startcheck = False
totError = 0

filename = TextBox_file1.Text
filename2 = TextBox_file2.Text
file1name = extractFilename(filename)
file2name = extractFilename(filename2)

If selectType = 1 Then
saveFilename = UDFolder + "\" + file1name + "_NCZvsNCZ.rep"
startcheck = startError()

If startcheck Then
'Header
FileSystem.PrintLine(1,
"************************************************")
FileSystem.PrintLine(1, " NCZ vs NCZ Comparison")
FileSystem.PrintLine(1, " " + file1name + ".NCZ vs " +
file2name + ".NCZ Comparison")
FileSystem.PrintLine(1, " " & Date.Now.ToString())
FileSystem.PrintLine(1,
"************************************************")
FileSystem.PrintLine(1, "")
FileSystem.PrintLine(1, "")

'Open and Sort file
Try
OpenSortNCZ(filename, 1)
OpenSortNCZ(filename2, 2)
Catch
MsgBox("Critical Error during opening file!",
MsgBoxStyle.Critical)
End
End Try

'Checking both file
Try
checkNCZVsNCZ()
Catch
MsgBox("Critical Error during checking file!",
MsgBoxStyle.Critical)
End
End Try
End If
............
End Sub

Public Function extractFilename(ByVal filename As String) As String
Dim strFullPathToFileName As String
Dim strPath As String
Dim strFileName As String
Dim backslashPos As Integer

'delete away \ path
strFullPathToFileName = filename
backslashPos = InStrRev(strFullPathToFileName, "\")
If backslashPos > 0 Then
strPath = Microsoft.VisualBasic.Left(strFullPathToFileName,
backslashPos)
strFileName = Mid(strFullPathToFileName, backslashPos + 1)
Else
strPath = ""
strFileName = strFullPathToFileName
End If

'delete away ext
strFileName = Microsoft.VisualBasic.Left(strFileName,
InStrRev(strFileName, ".") - 1)

'MsgBox(strFileName)
Return strFileName

End Function

Hope this helps.....
 
C

Cor Ligthert

Wong,

I don't see directly what can be the error, however one thing I see is that
you use some dangerous code in the part where it goes wrong by using the +
as concatenator instead from the &. This can give errors in some situation.

As well would I use the streamwriter in your situation, not that it helps,
however makes it in my opinion more readable.

http://msdn.microsoft.com/library/d.../html/frlrfsystemiostreamwriterclasstopic.asp

I hope this helps anyhow,

Cor
 
H

Herfried K. Wagner [MVP]

Wong_wj said:
Public Function extractFilename(ByVal filename As String) As String

You may want to use 'System.IO.Path.GetFileName' instead of your
implementation. (This won't solve the problem.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top