Hi
who knows how to overcome this error:
I defined an input field dim
dim = new TextBox();
according to the contents (is an integer) I define a twodimensional array of TextBox:
TextBox [,] a;
in the function
private void dim_Leave(object sender, EventArgs e)
{
try
{
int dm = Int.Parse(dim.Text);
a = new TextBox[dm, dm];
for (int i = 0; i < dm; i++)
{
for (int j = 0; j < dm; j++)
{
a[i, j] = new TextBox();
a[i, j].Location = new Point(j * 70 + 26, i * 20 + 70);
a[i, j].Size = new Size(68, 18);
a[i, j].Text = "";
this.Controls.Add(a[i, j]);
}
}
}
catch {}
By trying to add a[i,j] to the Controls I receive an error "Win32 Exception was unhandled" - error creating windowhandle.
In detail:
System.ComponentModel.Win32Exception was unhandled
Message="Fehler beim Erstellen des Fensterhandles."
Source="System.Windows.Forms"
ErrorCode=-2147467259
NativeErrorCode=0
StackTrace:
bei System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
bei System.Windows.Forms.Control.CreateHandle()
bei System.Windows.Forms.TextBoxBase.CreateHandle()
bei System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
bei System.Windows.Forms.Control.CreateControl()
bei System.Windows.Forms.Control.ControlCollection.Add(Control value)
bei System.Windows.Forms.Form.ControlCollection.Add(Control value)
bei Determinante.detA.dim_Leave(Object sender, EventArgs e) in C:\Users\Michael\Documents\Visual Studio 2008\Projects\Determinante\Determinante\detA.cs:Zeile 60.
bei System.Windows.Forms.Control.OnLeave(EventArgs e)
bei System.Windows.Forms.ContainerControl.UpdateFocusedControl()
bei System.Windows.Forms.ContainerControl.AssignActiveControlInternal(Control value)
bei System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control, Boolean originator)
bei System.Windows.Forms.Control.WmSetFocus(Message& m)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException:
The coding was already checked, it is ok and works in other machines, I restarted already my machine, the error remained unchanged, please help if you know how!
Thank you in advance
Your's
MiKr41