Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

erratic behavior of textbox in Elementhost

Posted on 2008-10-14
1
Medium Priority
?
257 Views
Last Modified: 2013-11-26
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
Comment
Question by:SqlServerDoc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
SqlServerDoc earned 0 total points
ID: 22716602
The issue has resolved.  I had a coding error that was causing the  creation of the control to be ignored. sorry.
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question