2011-11-21 156 views
-3
 // 
     // textEdit1 
     // 
     this.textEdit1.Location = new System.Drawing.Point(4, 20); 
     this.textEdit1.Name = "textEdit1"; 
     this.textEdit1.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.HotFlat; 
     this.textEdit1.Properties.MaxLength = 15; 
     this.textEdit1.Properties.NullValuePrompt = "<Beta Code>"; 
     this.textEdit1.Properties.NullValuePromptShowForEmptyValue = true; 
     this.textEdit1.Properties.PasswordChar = '*'; 
     this.textEdit1.Size = new System.Drawing.Size(250, 22); 
     this.textEdit1.TabIndex = 2; 

因爲這樣我得到5條警告消息和一個調用堆棧錯誤,這意味着我無法在設計器模式下查看它。調用堆棧錯誤 - C#

警告消息:

Warning 1 Object reference not set to an instance of an object. 
Warning 2 Object reference not set to an instance of an object. 
Warning 3 Object reference not set to an instance of an object. 
Warning 4 Object reference not set to an instance of an object. 
Warning 5 Object reference not set to an instance of an object. 

任何幫助,他讚賞。提前致謝。

調用堆棧:

at DevExpress.XtraEditors.Repository.RepositoryItem.CreateDesigner() 
at DevExpress.XtraEditors.Repository.RepositoryItem.FilterProperties(PropertyDescriptorCollection collection) 
at DevExpress.XtraEditors.Repository.RepositoryItem.System.ComponentModel.ICustomTypeDescriptor.GetProperties(Attribute[] attributes) 
at System.ComponentModel.TypeDescriptor.MergedTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties(Attribute[] attributes) 
at System.ComponentModel.TypeDescriptor.GetPropertiesImpl(Object component, Attribute[] attributes, Boolean noCustomTypeDesc, Boolean noAttributes) 
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.GetPropertiesHelper(IDesignerSerializationManager manager, Object instance, Attribute[] attributes) 
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertyAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement, CodePropertyReferenceExpression propertyReferenceEx, Boolean reportError) 
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement) 
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement) 
+0

的可能重複[什麼是.NET一個NullReferenceException?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-in-net) –

+0

this.textEdit1存在嗎?調用堆棧錯誤是什麼? – rlemon

+0

@rlemon我會將它添加到主帖子 – Neel

回答

0

你根本忘了喂數據的對象之一。確保所有需要數據的來源和對象都能得到它。

開始時用try和catch來省略一些代碼,看看錯誤是從哪裏來的,如果你可以通過檢查Call Stack來做到這一點的話。

0

我懷疑TextEdit.Properties對象沒有基於正在生成的警告數量(5個對Properties屬性的5次引用的警告)實例化。快速谷歌搜索顯示其他一些人有DevExpress控件的這個問題,雖然我找不到任何解決方案。

這裏有一些事情你應該嘗試:

  1. 確保已引用的所有適用的DevExpress的DLL。
  2. 嘗試從窗體/控制/等刪除您的TextEdit控件,並再次添加它。
  3. 將您的問題提交到DevExpress support center。他們通常非常敏感。