在VB.net中调用form.Show()时出现重复键错误

时间:2013-07-21 09:42:28

标签: vb.net winforms debugging key

我遇到了无法调试的问题。

我有一个表单,当我按下按钮时,它打开另一个这样的表格:

wfrmBkrShotefHitpalgutNechasim_Perut.Close()
wfrmBkrShotefHitpalgutNechasim_Perut.Text = pPageHeader
wfrmBkrShotefHitpalgutNechasim_Perut.kerenGUID = KodKeren
wfrmBkrShotefHitpalgutNechasim_Perut.TaarichNechonut = Taarich
wfrmBkrShotefHitpalgutNechasim_Perut.SugHitpalgut = MisHitpalgut
wfrmBkrShotefHitpalgutNechasim_Perut.KodKvutzatHitpalgut = cm.Current("Kod").ToString
wfrmBkrShotefHitpalgutNechasim_Perut.MdiParent = Me.MdiParent
wfrmBkrShotefHitpalgutNechasim_Perut.Show()

它正确完成新表单的所有加载,并在完成后完成,如果失败则执行显示。

我得到的消息Exception是: 项目已添加。键入字典:'kod'键被添加:'kod'

我不知道它在说什么列表/字典, 我查看了异常的详细信息,我看到了:

**System.ArgumentException =** {"Item has already been added. Key in dictionary: 'kod'  Key being added: 'kod'"}

**Data =** {System.Collections.ListDictionaryInternal} 

**Values =**  {System.Collections.ListDictionaryInternal.NodeKeyValueCollection}

**Keys =** {System.Collections.ListDictionaryInternal.NodeKeyValueCollection}

**Source:** "mscorlib"

**StackTrace =**    at System.Collections.SortedList.Add(Object key, Object value)    at
Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptorCollection.EnsureSortedList()
at
Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptorCollection.Find(String
name)    at
Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptorCollection.get_Item(String
name)    at
Syncfusion.Windows.Forms.Grid.Grouping.GridTableDescriptor.EnsureRecordRowColumns()
at
Syncfusion.Windows.Forms.Grid.Grouping.GridTableDescriptor.get_RecordRowColumns()
at
Syncfusion.Windows.Forms.Grid.Grouping.GridTableDescriptor.GetColumnSetColCount()
at
Syncfusion.Windows.Forms.Grid.Grouping.GridTableModelVolatileData.get_ColCount()
at Syncfusion.Windows.Forms.Grid.GridModel.get_ColCount()    at
Syncfusion.Windows.Forms.Grid.GridScroll.GetMaxColScrollPosition()   
at
Syncfusion.Windows.Forms.Grid.GridScroll.ColIndexToScrollPosition(Int32
colIndex)    at
Syncfusion.Windows.Forms.Grid.GridScroll.GetNextColIndex(Int32&
colIndex, Boolean skipFirstHidden)    at
Syncfusion.Windows.Forms.Grid.GridScroll.GetNextColIndex(Int32
colIndex, Boolean skipFirstHidden)    at
Syncfusion.Windows.Forms.Grid.GridControlBase.GetFirstScrollableCol()
at Syncfusion.Windows.Forms.Grid.GridControlBase.Initialize()    at
Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.Initialize() 
at
Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl.OptimizeLoadTime()
at
Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl.f_Load(Object
sender, EventArgs e)    at System.EventHandler.Invoke(Object sender,
EventArgs e)    at System.Windows.Forms.Form.OnLoad(EventArgs e)   
at System.Windows.Forms.Form.OnCreateControl()    at
System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)   
at System.Windows.Forms.Control.CreateControl()    at
System.Windows.Forms.Control.WmShowWindow(Message& m)    at
System.Windows.Forms.Control.WndProc(Message& m)    at
System.Windows.Forms.ScrollableControl.WndProc(Message& m)    at
System.Windows.Forms.ContainerControl.WndProc(Message& m)    at
System.Windows.Forms.Form.WmShowWindow(Message& m)    at
System.Windows.Forms.Form.WndProc(Message& m)    at
Syncfusion.Windows.Forms.Office2007Form.WndProc(Message& m)    at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&
m)    at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)    at
System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32
dwExStyle, String lpszClassName, String lpszWindowName, Int32 style,
Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent,
HandleRef hMenu, HandleRef hInst, Object pvParam)    at
System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32
dwExStyle, String lpszClassName, String lpszWindowName, Int32 style,
Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent,
HandleRef hMenu, HandleRef hInst, Object pvParam)    at
System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)    at
System.Windows.Forms.Control.CreateHandle()    at
System.Windows.Forms.Form.CreateHandle()    at
System.Windows.Forms.Control.get_Handle()    at
System.Windows.Forms.Form.SetVisibleCore(Boolean value)    at
System.Windows.Forms.Control.Show()    at
Elad.BakaratNeemanut.UI.wfrmBkrShotefHitpalgutNechasim.btnPerut_Click(Object
sender, EventArgs e) in
C:\WorkingFolder\NeemanutRoot\NeemanutWcfTest\UI\BakarotShotfot\wfrmBkrShotefHitpalgutNechasim.vb:line
242

**IsVurtual =** true

**FullQualifieldName** = "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll"

**Module =** {System.Reflection.Module}

如何找到错误并修复它的任何建议?

1 个答案:

答案 0 :(得分:0)

好人们别担心,

在新表单中我填充了一个网格,其中有两个同名的列:“kod”

这就是问题所在。

谢谢你。 最好的问候!