[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

erratic behavior of textbox in Elementhost

Hello.
I have a Visual Studio 2008 Visual Basic Windows Forms application. on one form I have 2 textboxes where I wanted to use the spell correction offered by the System.Windows.Controls.TextBox control. I have them created on the fly and it generally works just fine.  However sometimes, seemingly randomly, those two textboxes to not load correctly and you cannot see nor edit the text in those boxes. infact you can see the form beneath the currently displayed form through the hole where the control would be.  If you close the form and re-open it, all is usually well.  any thoughts on 1) how to prevent this or 2) how to detect that the situation has occured and try to reload the control? thanks!
In the form class definition I have:
   Public host1 As New ElementHost()
   Public host2 As New ElementHost()
   Public WithEvents Text_note1 As New System.Windows.Controls.TextBox
   Public WithEvents Text_note2 As New System.Windows.Controls.TextBox
 
...
 
form load event:
        host1.Width = 607
        host2.Width = 607
        host1.Height = 103
        host2.Height = 165
        host1.Child = Text_note1
        host2.Child = Text_note2
' the panel holds the place on the form for my control and sets the size
        Panel_note1.Controls.Add(host1)
        Panel_note2.Controls.Add(host2)
...
        AddHandler Text_note2.KeyDown, AddressOf Text_note2_KeyUp
        AddHandler Text_note1.KeyDown, AddressOf Text_note1_KeyUp

Open in new window

0
SqlServerDoc
Asked:
SqlServerDoc
1 Solution
 
SqlServerDocAuthor Commented:
The issue has resolved.  I had a coding error that was causing the  creation of the control to be ignored. sorry.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now