2010-07-03 101 views
2

我創建了一個名爲connector的類。通過點擊項目並添加一個班級。 而且我想以 的形式繼承該類,但是我得到這個錯誤。從vb.net中的類繼承的表單

Base class '<baseclassname1>' specified for class '<partialclassname>' cannot be different from the base class '<baseclassname2>' of one of its other partial types` 

我該怎麼辦? 這裏的命名connect.vb類: 進口MySql.Data.MySqlClient

Public Class connect 

    Private dataAdapter As New MySqlDataAdapter() 

    Dim dr As MySqlDataReader 

    Dim ds As New DataSet 
    Dim con As New MySql.Data.MySqlClient.MySqlConnection 
    Dim dsNewRow As DataRow 
    Dim cmd As MySqlCommand 
    Dim cn As MySqlConnection 
    Dim da As MySql.Data.MySqlClient.MySqlDataAdapter 
End Class 

而且我試圖從這個,這是一個形式,繼承它:

Public Class AdminForm 

    Inherits connect 


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 

     cn = New MySqlConnection("Server=localhost; Database=testing;Uid=root;Pwd=password;") 
     'provider to be used when working with access database 
     cn.Open() 
     cmd = New MySqlCommand("select * from student", cn) 
    End Sub 
End Class 

請幫助

+0

你可以發佈代碼的類和文件名? – Oded 2010-07-03 09:24:05

回答

2

.NET不支持多重繼承。你的表單(WinForm或ASP.NET)已經從基類派生,這意味着你不能從你的基類派生它。你可以採取的行動來解決這個問題很大程度上取決於你想要達到的目標。