2014-01-16 45 views
2

我做了一個C#程序,它允許我從Oracle數據庫獲取信息。現在我成功地在我的應用程序中顯示了一行。我的下一個目標是將數據庫信息放在一個gridview中,它也允許你點擊它來激活一個函數。我想知道如何做到這一點。我讀到:http://msdn.microsoft.com/en-us/library/system.windows.controls.gridview(v=vs.110).aspx,但我仍然沒有得到如何做到這一點。使用gridview時模糊參考

在開始的時候,它說

Namespace: System.Windows.Controls 

Assembly: PresentationFramework (in PresentationFramework.dll) 

現在我已經找到了參考PresentationFramework和我說了。從那以後,我加入

using System.Windows.Controls

當我將我得到一個錯誤的參考:

Error 1 'UserControl' is an ambiguous reference between 'System.Windows.Forms.UserControl' and 'System.Windows.Controls.UserControl'  

在:

public partial class DockableWindow : UserControl 
{ 

Error 2 'ArcMapAddin28.DockableWindow' does not contain a definition for 'Handle' and no extension method 'Handle' accepting a first argument of type 'ArcMapAddin28.DockableWindow' could be found (are you missing a using directive or an assembly reference?) 

at:

 protected override IntPtr OnCreateChild() 
     { 
      m_windowUI = new DockableWindow(this.Hook); 
      return m_windowUI.Handle; //red line under the word Handle 
     } 

這是怎麼回事?

這是甚至正確的方式來達到我的下一個目標?

+0

你在問關於WPF,Windows Forms還是什麼? –

+0

我編輯過你的標題。請參閱:「[應該在其標題中包含」標籤「](http://meta.stackexchange.com/questions/19190/)」,其中的共識是「不,他們不應該」。 –

+0

@JohnSaunders好的謝謝。 Windows窗體順便說一句。 – Loko

回答