error in designers form
-
20 februarie 2012 17:35
hi everyone
i have no idea how to fix a form design error can someone help me with that
when i open the form it shows this
Value cannot be null. Parameter name: objectType
Instances of this error (1) 1. Hide Call Stack at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.GetRuntimeType(Type objectType)
at System.ComponentModel.TypeDescriptionProvider.GetRuntimeType(Type reflectionType)
at Microsoft.VisualStudio.Design.MultiTargetingContextProvider.GetRuntimeType(Type objectType)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.HandlesClauseManager.GetFieldType(String fieldName, Type documentBaseType)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.HandlesClauseManager.GetReferencedComponentType(String componentName, CodeTypeDeclaration codeTypeDecl, ITypeResolutionService loader, IDictionary& cache)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.HandlesClauseManager.ParseHandlesClauses(CodeTypeDeclaration codeTypeDecl, Boolean updateCache)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnMethodPopulateStatements(Object sender, EventArgs e)
at System.CodeDom.CodeMemberMethod.get_Statements()
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)i have no idea how to fix that
Toate mesajele
-
20 februarie 2012 17:39try closing all open windows in Visual studio and doing a clean build will help, if there are no designer issues with the form. Most of the times, it works for me
--Krishna
-
20 februarie 2012 19:49
thanks for your answer
i tried it and i still have this error
is there any guide or way how to fix such error?
-
20 februarie 2012 20:56
Not sure. I dont think there is any.
wild guess. Are you using any custom controls ? If so, looks like they are throwing an exception while setting an attribute value of null to it by designer.
--Krishna
-
20 februarie 2012 21:29
maybe my code will help understand what my problem is
here is the code
when i run the project the form does not fill so it seems that something is wrong with the tableadapter or rather with the property in the adapter but i can't get what is wrong
Public Class frmEditPerson Private Sub Edit_Person_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load 'TODO: This line of code loads data into the 'ShullaccountDataSet.membertype' table. You can move, or remove it, as needed. Me.MembertypeTableAdapter.Fill(Me.ShullaccountDataSet.membertype) 'TODO: This line of code loads data into the 'ShullaccountDataSet.members' table. You can move, or remove it, as needed. Me.MembersTableAdapter.FillBy(Me.ShullaccountDataSet.members, _ Val(frmMain.dgvBasicMemberInfo.Item(1, frmMain.dgvBasicMemberInfo.CurrentRow.Index).ToString)) End Sub Private Sub FirstLastFatherAddress_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) If Not Char.IsLetter(e.KeyChar) And Not Char.IsControl(e.KeyChar) And e.KeyChar <> " " Then e.Handled = True End If End Sub Private Sub txtTelZip_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) _ Handles mtxtel.KeyPress, ZipTextBox.KeyPress If Not Char.IsNumber(e.KeyChar) And Not Char.IsControl(e.KeyChar) And e.KeyChar <> " " Then e.Handled = True End If End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click If FirstnameTextBox.Text = "" Or LastnameTextBox.Text = "" Then MessageBox.Show("First and last name can not be empty", "Add Person", MessageBoxButtons.OK, MessageBoxIcon.Information) Else Dim result As New DialogResult result = MessageBox.Show("Are you sure you want to edit this person", "Add Person" _ , MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) If result = Windows.Forms.DialogResult.Yes Then Me.Validate() Me.MembersBindingSource.EndEdit() Me.TableAdapterManager.UpdateAll(Me.ShullaccountDataSet) Shull_Account.frmMain.BasicMemberInfoTableAdapter.Fill _ (Shull_Account.frmMain.ShullaccountDataSet.BasicMemberInfo) frmMain.dgvBasicMemberInfo.Refresh() Me.Close() End If End If End Sub End Class
-
21 februarie 2012 18:16when i comment out the code in the form initialize component the error is still there only when i comment initialize sub it self then the error dissapears
-
23 februarie 2012 08:08ModeratorHi Jacob,
Could you please try the following things?
The first one is rebuilding. Open the form in the designer, clean the project, build the project, close the form in the designer, and open it again.
The second one is changing the class modifier to public (one is in designer.vb).
The third one is debugging. Common out the line <System.Diagnostics.DebuggerStepThrough()> _ from your InitializeComponent sub, then debug the code to check where this error throw.
If none of them works could you please share the code on the skydrive or share the code in the designer here?
Please let us know the result.
Best Regards,Bob Wu [MSFT]
MSDN Community Support | Feedback to us