Hi Cor
Here is the exact code for the 2 forms:
Form1:
************************************************** ***************
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(88, 56)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1})
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Dim ds As New DataSet()
Dim frm As Form2
Dim i As Integer
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
createDS()
End Sub
Public Sub createDS()
Dim dt As New DataTable()
ds.Tables.Add(dt)
dt.Columns.Add("Numbers", GetType(System.Int32))
dt.Columns.Add("Characters")
For i = 0 To 9
ds.Tables(0).Rows.Add(ds.Tables(0).NewRow)
ds.Tables(0).Rows(i).ItemArray = _
(New Object() {i.ToString, ChrW(i + 65)})
Next
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
frm = New Form2(ds)
' frm.Owner = Me
frm.Show()
End Sub
End Class
************************************************** ***************
Form2:
************************************************** ***************
Public Class Form2
Inherits System.Windows.Forms.Form
Private ds1 As DataSet
#Region " Windows Form Designer generated code "
Public Sub New(ByVal ds As DataSet)
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
ds1 = ds
'Add any initialization after the InitializeComponent() call
DataGrid1.DataSource = ds1.Tables(0)
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.DataGrid1 = New System.Windows.Forms.DataGrid()
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginIni t()
Me.SuspendLayout()
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(264, 256)
Me.DataGrid1.TabIndex = 0
'
'Form2
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.DataGrid1})
Me.Name = "Form2"
Me.Text = "Form2"
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit( )
Me.ResumeLayout(False)
End Sub
#End Region
End Class
************************************************** ***************
And here is exact what I do:
I start the program
Then I click Button1
Then I add the values "99", "Testing" to a row. And click with the mouse in
a NEW row to save this row (ie the row with the * to the left). This is very
important for the error to appear. Sorry I forgot to tell that. If you
create the row and click in an old row the error will not appear.
Then I close Form2
Then I open Form2
Then I delete the row with values "99", "Testing" by marking the record
selector with the mouse and pressing the Delete key
Then the error appears
Jan
"Cor Ligthert" <no************@planet.nl> skrev i en meddelelse
news:eS**************@TK2MSFTNGP09.phx.gbl...
Jan,
I would not know why, I don't have that any more installed.
However would look strange to me, you tested it exactly with that sample
program as you showed me?
(And does the delete just with the delete key)
Cor
"Jan Nielsen"
Hi Cor
Yes, I noticed the form12 thing.
I use VS 2002. Could that be the problem?
Jan
Jan
"Cor Ligthert" <no************@planet.nl> skrev i en meddelelse
news:%2****************@TK2MSFTNGP12.phx.gbl... Jan,
I tested what you sent, however that did not throw an error in the way
as you told it.
Not important, however in my sample is an typor there is on someplaces
form12 what has to be form2 (i changed it in the text)
Cor