منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : vshost.exe has stopped working
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
الصفحات : 1 2 3
الى حتى الان أحاول حل المشكلة ولكن بدون جدوى
اخ myalsailamy
و من  كلامك معناتوه عندك  خطأ في اعدادات المشروع او شيء تركب خطأ  ،،  أسهل طريقة  تعيد انشاء المشروع  و تضيف الاكواد  و الـ Forms  الي انشأتها  سابقا  و  refrence و غيرها من الاشياء و تجرب  تشغله و تشوووف هل بيتغير شيء او نفس المشكله  ،  ايضا حاول تفرغ  مجلدين  ( bin  و  Obj ) امسح الي بداخلها نهائي  و جرب تشغل المشروع القديم

تم انشاء المشروع إضافة الاكواد و الـ Forms  الي انشأتها  سابقا  و  refrence و غيرها من الاشياء ولكن دون جدوى للأسف هل احد عنده حل بارك الله فيكم
باقي خطوه معينه ،، تحديد مكان الخطأ


يعني استخدم طريقة التخمين و الاستبعاد / فمثلاً ابدا ضيف أجزاء في المشروع و جرب هل يختفي الخطأ او يبقى ،، على العموم بالنهاية اذا لم تقدم السورس كود لن يستطيع احد مساعدتك ، لان المساعده هنا تخمينات و يبقى الحل لديك انت .

و قد يكون الخلل من جهازك فقط ، بسبب تركيب خاطئ لاحد البرامج او عدم توافق الاصدارات ،، جربه على جهاز اخر
السلام عليكم

ليس هنالك خطأ انت تريد ان تنفذ الكود مرتين والبرنامج لايسمح به
فقط اكتب كود تجاوز الخطأ وسيتم التنفيذ بدون خروج من البرنامج
[quote pid='67652' dateline='1450343996']
الاخوة الاحباب نشكركم جميعا على المرور الى هذا اللحظة ما وجدت حل وبالنسبة الى الكود المستخدم كالتالي

كود :
   Try
           ListBox1.ClearSelected()
       Catch ex As Exception

       End Try
       Dim Password As String
Sniper:
       Try
           Dim OpenFileDialog1 As New OpenFileDialog
           Dim DataSet1 As New DataSet
           If Password = "" Then
               Dim myStream As Stream = Nothing
               OpenFileDialog1.Filter = "Files (*.mdb;*.accdb;*.xls;*.xlsx)|*.mdb;*.accdb;*.xls;*.xlsx"
               OpenFileDialog1.Title = "Select a Cursor File"
               OpenFileDialog1.FilterIndex = 2
               OpenFileDialog1.RestoreDirectory = True
               If OpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
                   Try
                       myStream = OpenFileDialog1.OpenFile()
                       If (myStream IsNot Nothing) Then
                           DataBasePath = OpenFileDialog1.FileName.ToString
                       End If
                   Catch Ex As Exception
                       MessageBox.Show("Cannot read file from disk. Original error: " & Ex.Message)
                   Finally
                       If (myStream IsNot Nothing) Then
                           myStream.Close()
                       End If
                   End Try
               End If
           End If
           Con55 = New OleDbConnection(GetProvider(DataBasePath, Password))
           Con55.Open()
           Dim schemaTable As DataTable = Con55.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
           Dim Tables = (From Row As DataRow In schemaTable.Rows Where Row("TABLE_TYPE") = "TABLE" Select Row.Item("TABLE_NAME")).ToArray
           ListBox1.Items.Clear()
           ListBox1.Items.AddRange(Tables)
           Con55.Close()
       Catch ex As Exception
           If Con55.State = ConnectionState.Open Then Con55.Close()
           Password = InputBox("أدخل كلمة المرور لقاعدة البيانات", "كلمة المرور")
           If Not String.IsNullOrEmpty(Password) Then
               GoTo Sniper
           End If

       Finally
           If Con55.State = ConnectionState.Open Then Con55.Close()
       End Try


[/quote]
انا شايف انك معقد المسالة، ومن الكود بدك تعرف اسماء الجداول، ممكن يكون هاد الكود ابسط لك، جرب وخبرني
كود :
Dim OpenFileDialog1 As New OpenFileDialog With {
    .Filter = "Access (*.mdb;*.accdb)|*.mdb;*.accdb;|Excel (*.xls;*.xlsx)|*.xls;*.xlsx;",
    .Title = "Select a Cursor File",
    .FilterIndex = 2,
    .RestoreDirectory = True
   }

If OpenFileDialog1.ShowDialog() = DialogResult.OK Then

    GetProvider(DataBasePath, Password)

    If Not Con55.State() = ConnectionState.Open Then Con55.Open()
Dim schemaTable As DataTable = Con55.GetSchema("Tables", New String() {Nothing, Nothing, Nothing, "Table"})
    Con55.Close()
Dim Tables = (From r In schemaTable Select r("TABLE_NAME")).ToArray
    ListBox1.Items.Clear()
    ListBox1.Items.AddRange(Tables)

End If
بسم الله الرحمن الرحيم
نشكر اخي hamada558  لمشاركة في حل المشكلة ولكن الى حتى الان بعد إضافة الكود لم نحل المشكلة وهنا الكود المستخدم كامل
كود :
 Public Function GetProvider(ByVal PathStr As String, Optional ByVal Password As String = "") As String
       Dim ProviderStr As String
       Select Case Path.GetExtension(PathStr)
           Case ".mdb"
               ProviderStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & PathStr & ";Jet OLEDB:Database Password=" & Password & ";"
           Case ".accdb"
               ProviderStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & PathStr & ";Persist Security Info=False;" & ";Jet OLEDB:Database Password=" & Password & ";"
           Case ".xls"
               ProviderStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & PathStr & ";Extended Properties=Excel 8.0;"
           Case ".xlsx"
               ProviderStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & PathStr & ";Extended Properties=Excel 8.0;"
       End Select
       Return ProviderStr
   End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Try
           ListBox1.ClearSelected()
       Catch ex As Exception

       End Try
       Dim Password As String
Sniper:
       Try
           Dim OpenFileDialog1 As New OpenFileDialog
           Dim DataSet1 As New DataSet
           If Password = "" Then
               Dim myStream As Stream = Nothing
               OpenFileDialog1.Filter = "Files (*.mdb;*.accdb;*.xls;*.xlsx)|*.mdb;*.accdb;*.xls;*.xlsx"
               OpenFileDialog1.Title = "Select a Cursor File"
               OpenFileDialog1.FilterIndex = 2
               OpenFileDialog1.RestoreDirectory = True
               If OpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
                   Try
                       myStream = OpenFileDialog1.OpenFile()
                       If (myStream IsNot Nothing) Then
                           DataBasePath = OpenFileDialog1.FileName.ToString
                       End If
                   Catch Ex As Exception
                       MessageBox.Show("Cannot read file from disk. Original error: " & Ex.Message)
                   Finally
                       If (myStream IsNot Nothing) Then
                           myStream.Close()
                       End If
                   End Try
               End If
           End If
           Con55 = New OleDbConnection(GetProvider(DataBasePath, Password))
           Con55.Open()
           Dim schemaTable As DataTable = Con55.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
           Dim Tables = (From Row As DataRow In schemaTable.Rows Where Row("TABLE_TYPE") = "TABLE" Select Row.Item("TABLE_NAME")).ToArray
           ListBox1.Items.Clear()
           ListBox1.Items.AddRange(Tables)
           Con55.Close()
       Catch ex As Exception
           If Con55.State = ConnectionState.Open Then Con55.Close()
           Password = InputBox("أدخل كلمة المرور لقاعدة البيانات", "كلمة المرور")
           If Not String.IsNullOrEmpty(Password) Then
               GoTo Sniper
           End If

       Finally
           If Con55.State = ConnectionState.Open Then Con55.Close()
       End Try
   End Sub
بسم الله الرحمن الرحيم
باعتقد ان هذا المشكلة ولا شخص حلها حتى الان قد يكون لدى الاخوة القدامى الخبرة والتجربة لحل هذه المشكلة
جرب وخبرني
كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim OpenFile As New OpenFileDialog With {
        .Filter = "Access (*.mdb;*.accdb)|*.mdb;*.accdb;|Excel (*.xls;*.xlsx)|*.xls;*.xlsx;",
        .Title = "Select a Cursor File"
       }

    If OpenFile.ShowDialog() = DialogResult.OK Then
        Con55.ConnectionString = GetProvider(OpenFile.FileName)

        Dim password As String = ""

        Try
            Con55.Open()
        Catch ex As Exception
            password = InputBox("قاعدة البيانات قد تتطلب كلمة مرور")
            Con55.ConnectionString = GetProvider(OpenFile.FileName, password)
        End Try

        ListBox1.Items.Clear()
        Try

            If Con55.State <> ConnectionState.Open Then Con55.Open()
            Dim schemaTable As DataTable = Con55.GetSchema("Tables", New String() {Nothing, Nothing, Nothing, "Table"})
            Con55.Close()
            Dim Tables = (From r In schemaTable Select r("TABLE_NAME")).ToArray
            ListBox1.Items.AddRange(Tables)

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End If

End Sub

Public Function GetProvider(ByVal PathStr As String, Optional ByVal Password As String = "") As String
    Dim ProviderStr As String
    Select Case Path.GetExtension(PathStr)
        Case ".mdb"
            ProviderStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & PathStr & ";Jet OLEDB:Database Password=" & Password & ";"
        Case ".accdb"
            ProviderStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & PathStr & ";Persist Security Info=False;" & ";Jet OLEDB:Database Password=" & Password & ";"
        Case ".xls"
            ProviderStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & PathStr & ";Extended Properties=Excel 8.0;"
        Case ".xlsx"
            ProviderStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & PathStr & ";Extended Properties=Excel 8.0;"
    End Select
    Return ProviderStr
End Function

سؤال هل انت واضع أداة OpenFileDialog1 من أدوات الفجوال؟
بسم الله الرحمن الرحيم
اخي hamada558 شكر على المشاركة تم تجرية الكود وتم  وضع أداة OpenFileDialog1 من أدوات الفجوال ولكن ظهر لي خطأ كما في الصورة
(22-12-15, 02:12 PM)hamada558 كتب : [ -> ]جرب وخبرني
كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim OpenFile As New OpenFileDialog With {
        .Filter = "Access (*.mdb;*.accdb)|*.mdb;*.accdb;|Excel (*.xls;*.xlsx)|*.xls;*.xlsx;",
        .Title = "Select a Cursor File"
       }

    If OpenFile.ShowDialog() = DialogResult.OK Then
        Con55.ConnectionString = GetProvider(OpenFile.FileName)

        Dim password As String = ""

        Try
            Con55.Open()
        Catch ex As Exception
            password = InputBox("قاعدة البيانات قد تتطلب كلمة مرور")
            Con55.ConnectionString = GetProvider(OpenFile.FileName, password)
        End Try

        ListBox1.Items.Clear()
        Try

            If Con55.State <> ConnectionState.Open Then Con55.Open()
            Dim schemaTable As DataTable = Con55.GetSchema("Tables", New String() {Nothing, Nothing, Nothing, "Table"})
            Con55.Close()
            Dim Tables = (From r In schemaTable Select r("TABLE_NAME")).ToArray
            ListBox1.Items.AddRange(Tables)

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End If

End Sub

Public Function GetProvider(ByVal PathStr As String, Optional ByVal Password As String = "") As String
    Dim ProviderStr As String
    Select Case Path.GetExtension(PathStr)
        Case ".mdb"
            ProviderStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & PathStr & ";Jet OLEDB:Database Password=" & Password & ";"
        Case ".accdb"
            ProviderStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & PathStr & ";Persist Security Info=False;" & ";Jet OLEDB:Database Password=" & Password & ";"
        Case ".xls"
            ProviderStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & PathStr & ";Extended Properties=Excel 8.0;"
        Case ".xlsx"
            ProviderStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & PathStr & ";Extended Properties=Excel 8.0;"
    End Select
    Return ProviderStr
End Function

سؤال هل انت واضع أداة OpenFileDialog1 من أدوات الفجوال؟

[attachment=8821]
الصفحات : 1 2 3