PDA

View Full Version : پیدا کردن خطا از روی شماره



jannati
چهارشنبه 01 بهمن 1382, 10:29 صبح
با سلام به همه دوستان
میخواستم بدونم وقتی با یک خطا برخورد میکنیم که فقط شماره داره (از نوع خطاهای زمان اجرا)چطور میتونیم از روی شماره به خود خطا دسترسی داشته باشیم.درصورتی که این خطا بدون گزینه Helpبوجود بیاد.این خطا رو از رو سایت میکروسافت میشه پیدا کرد یا تو سی دی های MSDN?ببخشید .شاید خیلی براتون ابتدایی باشه.اما ندانستن عیب نیست .نپرسیدن عیبه!مگه نه؟!!! :oops: :wink:

الهام تفریشی
چهارشنبه 01 بهمن 1382, 11:22 صبح
به احتمال زیاد از MSDN میتونی کمک بگیری

BehnamPro
چهارشنبه 01 بهمن 1382, 13:07 عصر
می تونی از برنامه Error Lookup که در Visual Studio6.0 Tools وجود داره استفاده کنی.وقتی شماره Error رو می دی یه توضیح کوتاهی در بارش بهت میده.البته در مواردی هم اصلا جوابی نمیده! :roll:

jannati
چهارشنبه 01 بهمن 1382, 13:30 عصر
از شما دوستانی که وقت گذاشتید و جواب دادید خیلی ممنون.به نظرم بهتره مشکلمو واضحتر بگم(با عرض شرمندگی :oops: ).راستش من یک برنامه را Setupکردم و حالا روی یکی از دستگاهها وقتی میخوام نصب کنم ،نصب میشه ولی موقع اجرا خطای( Rum_time Error76)میده .میخوام ببینم معنی این خطا چیه ؟حالا باید تو VBبگردم یا Helpویندوز؟با این توضیح که مطمئن هستم برنامه ستاپ مشکلی نداره. :? :roll:

vbstar
چهارشنبه 01 بهمن 1382, 14:53 عصر
دوست عزیز شما سورس برنامه را اگر داری ، اول برنامه را در vb باید شما Trace کنی ببینی که مشکل برنامه از کجاست.
چون packeg wizard‌ در setup برنامه ها هیچ مشکلی نداره ، مگر اینکه فایلهایی که به برنامه دباید اصافه کنی کم باشد.

Vahab
چهارشنبه 01 بهمن 1382, 23:31 عصر
ماکروسافت چه میگوید:


If you use the File System Object to determine the size of a folder, you receive the following error message when you call the Size method for a root folder ("C:") on a computer that is running Microsoft Windows 95, Microsoft Windows 98, or Microsoft Windows Millennium Edition (Me):

Runtime Error 76
Path Not Found
The code that causes this error appears similar to the following code: Dim fso As FileSystemObject
Set fso = New FileSystemObject
Dim f As Folder
Set f = fso.GetFolder("C:\")
Dim amnt As Double
' This line fails with the error.
amnt = f.Size

This same code works as expected on a computer that is running Microsoft Windows NT, Microsoft Windows 2000, or Microsoft Windows XP.
CAUSE
When you use the name of the folder (the FolderPath property) in the code for the Size function of the File System Object, the root folder has a trailing slash, and all of the other folders do not have a trailing slash. This causes logic such as "FolderPath\*" to fail on the root folder because the resulting string is "C:\\*". A string such as this should return all of the files and the folders in that folder. However, this string fails on a computer that is running Windows 95, Windows 98, or Windows Millennium Edition with the error message that is listed in the "Symptoms" section of this article. Windows NT, Windows 2000, and Windows XP just ignore the double slash and return the correct list of files and folders.

The code in the Size method should remove the slash from the FolderPath for the root folder before it performs operations.
RESOLUTION
To work around this problem, provide a custom Size method that handles the root folder. For example, use the following code instead of Folder.Size: Function Size ( f As Folder ) As Double
Dim amnt As Double
If f.IsRootFolder = False Then
amnt = f.Size
Else
Dim myFile As File
For Each myFile In f.Files
amnt = amnt + myFile.Size
Next
Dim myFolder As Folder
For Each myFolder In f.SubFolders
amnt = amnt + myFolder.Size
Next
amnt = amnt
End If
Size = amnt
End Function

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
MORE INFORMATION
Steps to Reproduce the Behavior
Create a new Standard EXE project in Visual Basic 6.0.
On the Project menu, click References, and then click to select the Microsoft Scripting Runtime check box.
Add two CommandButton controls and one TextBox control to the form.
Add the following code to the form:Option Explicit

Private Sub Command1_Click()
Dim fso As FileSystemObject
Set fso = New FileSystemObject
Dim f As Folder
'Get a reference to the File object.
Set f = fso.GetFolder("C:\")
Text1.Text = f.Size
End Sub

Private Sub Command2_Click()
Dim fso As FileSystemObject
Set fso = New FileSystemObject
Dim f As Folder
'Get a reference to the File object.
Set f = fso.GetFolder("C:\")
Text1.Text = Size(f)
End Sub

Function Size ( f As Folder ) As Double
Dim amnt As Double
If f.IsRootFolder = False Then
amnt = f.Size
Else
Dim myFile As File
For Each myFile In f.Files
amnt = amnt + myFile.Size
Next
Dim myFolder As Folder
For Each myFolder In f.SubFolders
amnt = amnt + myFolder.Size
Next
End If
Size = amnt
End Function

To compile the project, click Make Project1.exe on the File menu.
Run the Project1.exe file on a computer that is running Windows 95, Windows 98, or Windows Millennium Edition.
Click Command1. Notice that you receive the error message that is listed in the "Symptoms" section of this article.
Click Command2. Notice that the text box displays the size of drive C.
NOTE: This same behavior occurs in any environment that uses the Microsoft Scripting Runtime.
General Advice
When you work with the root folder, the folder name is returned with a trailing slash (for example, "C:\"). All of the other folders are returned without a trailing slash (for example, "C:\Temp"). When programmatic logic expects that the folder name does not include a trailing slash, this logic can fail when it is run on the root folder (for example, as in the case of Folder.Size).

You must work around this problem when you create paths. If a path can be concatenated off of the root folder or off of another folder location, double slashes can appear when you use the same logic for both the root folder and the other folder paths.

The following code removes the slash from the end of a string if the slash is present (for example, for the root folder): Function DirPath(ByRef Path As String) As String
If Right(Path, 1) = "\" Then
DirPath = Mid(Path, 1, Len(Path) - 1)
Else
DirPath = Path
End If
End Function

The problem is that you must add special handling to code that deals with the file system to account for the root folder. You may experience this problem in other scenarios, but they are all handled in a similar way.

jannati
شنبه 04 بهمن 1382, 09:47 صبح
با تشکر از شما دوست عزیز که راهنمایی کردید!راستش هیچ کدام از موارد بالا در پروژه من نیست.مشکل اینجاست که من برنامه را Setupکردم و حالا که روی یک دستگاه نصب میکنم با اینکه ODBCرا دستی ست کردم و تمام مسیرها را چک کردم باز این مشکل موجود است!!! :( :cry: :?