?
Solved

Cant select text in Textbox on a Form which is a control

Posted on 2005-03-22
5
Medium Priority
?
211 Views
Last Modified: 2008-02-01
I have a problem I cannot figure out.
Im unable to use the mouse to select text or position the cursor within a textbox on forms, which are assigned to the control collection of another form.
The code Im using to open & display the form is as follows.

        Dim frmFieldEditor As New frmFieldEditor()

        frmFieldEditor.TopLevel = False
        frmFieldEditor.fldText = e.TextField
        Me.Controls.Add(frmFieldEditor)
        frmFieldEditor.Show()
        frmFieldEditor.BringToFront()

The form operates just fine, except the textboxes on the fieldeditor form will not allow me to use the mouse to manipulate the text.

Thanks.
0
Comment
Question by:Jimby_Aus
[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
  • 3
  • 2
5 Comments
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 13599323
have you setting the textbox.enabled = true
0
 
LVL 1

Author Comment

by:Jimby_Aus
ID: 13599362
yes textbox is enabled.
I can type in the textbox OK, I just cant use the mouse to change the cursor position or select text.

0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 13599394
Is there a reason to add the form to the controls of the calling form, it seems very strange to do this (this is what causes the problem)
0
 
LVL 1

Author Comment

by:Jimby_Aus
ID: 13599567
Yes, because I want to keep the form in the boundaries of its parent form, without using MDI.
MDI will not work for this, because I have a control that fills the entire parent form, and MDI child windows would appear behind it, which no good.
0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 1500 total points
ID: 13599814
Well for as far as I now, you are out of luck because the mousecursor is always relative to the owner form in this case your main form hence it is unable to paint and place the cursor correctly. You can test this by adding a mousedown event to your textbox like

    Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
        TextBox1.Cursor.Position = New Point(e.X, e.Y)
    End Sub

you will see that the mouse pointer will jump to your mainform
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

765 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