Getting "Error creating window handle." and don't know why

G

Guest

Hey guys,

Here is whats happening. I have a StringBuilder, a TextBox, and a
TabControl with one TabPage. On my main form, I created and displayed a
fairly big maze. While the app is solving the maze, it appends each step it
takes to the StringBuilder.

When the maze is solved, the user can click a menu item to display the
results. When the menu item is clicked, I set the TextBox Text value using
the StringBuilder's ToString() method and the TabControl, which starts with
Visible = false is displayed by setting Visible= true. That is the line that
causes this error:

_results.Visible = true; // _results is the TabControl

A first chance exception of type 'System.ComponentModel.Win32Exception'
occurred in system.windows.forms.dll

Additional information: Error creating window handle.

Now, I'm not sure what is causing this error. The TextBox is the only
control on the single existing TabPage and is set to Fill the page. Can it
be that there are too many lines in the TextBox? After solving the maze,
there are 18362 lines of text to be displayed. Is that a problem because
everyhting works fine when I am dealing with smaller mazes and fewer lines of
text.

Any help is greatly appreciated :)

P.S. The strange thing is that rarely it works fine even with a huge amount
of text.

Following is the call stack:


system.windows.forms.dll!System.Windows.Forms.NativeWindow::CreateHandle(System.Windows.Forms.CreateParams
cp = {System.Windows.Forms.CreateParams}) + 0x264 bytes
system.windows.forms.dll!System.Windows.Forms.Control::CreateHandle() +
0x19a bytes
system.windows.forms.dll!System.Windows.Forms.TextBoxBase::CreateHandle()
+ 0x30 bytes
system.windows.forms.dll!System.Windows.Forms.Control::CreateControl(bool
fIgnoreVisible = false) + 0xd4 bytes
system.windows.forms.dll!System.Windows.Forms.Control::CreateControl(bool
fIgnoreVisible = false) + 0x1b1 bytes
system.windows.forms.dll!System.Windows.Forms.Control::CreateControl() +
0x12 bytes
system.windows.forms.dll!System.Windows.Forms.Control::SetVisibleCore(bool
value = true) + 0x143 bytes
system.windows.forms.dll!System.Windows.Forms.Control::set_Visible(bool
value = true) + 0x1e bytes
system.windows.forms.dll!System.Windows.Forms.TabPage::set_Visible(bool
value = true) + 0x1c bytes
system.windows.forms.dll!System.Windows.Forms.TabControl::UpdateTabSelection(bool uiselected = false) + 0xe1 bytes
system.windows.forms.dll!System.Windows.Forms.TabControl::OnHandleCreated(System.EventArgs e = {System.EventArgs}) + 0x27d bytes
system.windows.forms.dll!System.Windows.Forms.Control::WmCreate(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x7b bytes
system.windows.forms.dll!System.Windows.Forms.Control::WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x373 bytes
system.windows.forms.dll!System.Windows.Forms.TabControl::WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x182 bytes
system.windows.forms.dll!ControlNativeWindow::OnMessage(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x19 bytes
system.windows.forms.dll!ControlNativeWindow::WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0xda bytes
system.windows.forms.dll!System.Windows.Forms.NativeWindow::DebuggableCallback(__int32
hWnd = 3083886, __int32 msg = 1, __int32 wparam = 0, __int32 lparam =
1304468) + 0x39 bytes
system.windows.forms.dll!System.Windows.Forms.UnsafeNativeMethods::CreateWindowEx(__int32
dwExStyle = 0, String* lpszClassName = "WindowsForms10.SysTabControl32.app1",
String* lpszWindowName = null, __int32 style = 1442908162, __int32 x = 983,
__int32 y = 0, __int32 width = 224, __int32 height = 983, __int32 hWndParent
= 13830492, __int32 hMenu = 0, __int32 hInst = 4194304, System.Object pvParam
= null) + 0x3c bytes
system.windows.forms.dll!System.Windows.Forms.NativeWindow::CreateHandle(System.Windows.Forms.CreateParams
cp = {System.Windows.Forms.CreateParams}) + 0x1d6 bytes
system.windows.forms.dll!System.Windows.Forms.Control::CreateHandle() +
0x19a bytes
system.windows.forms.dll!System.Windows.Forms.TabControl::CreateHandle() +
0x49 bytes
system.windows.forms.dll!System.Windows.Forms.Control::CreateControl(bool
fIgnoreVisible = false) + 0xd4 bytes
system.windows.forms.dll!System.Windows.Forms.Control::CreateControl() +
0x12 bytes
system.windows.forms.dll!System.Windows.Forms.Control::SetVisibleCore(bool
value = true) + 0x143 bytes
system.windows.forms.dll!System.Windows.Forms.Control::set_Visible(bool
value = true) + 0x1e bytes
 
G

Guest

I believe that TextBox has a 64K character limit. Try using RichTextBox, as
it does not have this limit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top