By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,215 Members | 1,941 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,215 IT Pros & Developers. It's quick & easy.

Textbox in a from that is loaded into a Panlel Mouse select on txtbox not working

P: n/a
Hi I am using vb.net 2005 this is a windows application

I am using this functionality in another project I have created this
simple project to show the problem
Basically I have two forms:
Form1 - contains a panel (System.Windows.Forms.Panel)
Form2 - contains two textboxes with some sample text in them
If the Form2 is executed on its own the textboxes work fine you can
use your mouse to select a portion of the text and copy paste it
However if I run the Form2 in a panel in Form1 the functionality of
the textboxes is gone you can no longer use the mouse to select parts
of the text you can only souble click to select the whole contents of
the textbox.
this is the code I am using:
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim frmToDisplay As New Form2
frmToDisplay.TopLevel = False
Panel1.Controls.Clear()
Panel1.Controls.Add(frmToDisplay)
frmToDisplay.Show()
frmToDisplay.Activate()
End Sub
End Class
Does anyone know id this is a bug with VB 2005 or am I doing
something
wrong?
THANKS

Feb 15 '07 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Brano wrote:
Hi I am using vb.net 2005 this is a windows application

I am using this functionality in another project I have created this
simple project to show the problem
Basically I have two forms:
Form1 - contains a panel (System.Windows.Forms.Panel)
Form2 - contains two textboxes with some sample text in them
If the Form2 is executed on its own the textboxes work fine you can
use your mouse to select a portion of the text and copy paste it
However if I run the Form2 in a panel in Form1 the functionality of
the textboxes is gone you can no longer use the mouse to select parts
of the text you can only souble click to select the whole contents of
the textbox.
this is the code I am using:
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim frmToDisplay As New Form2
frmToDisplay.TopLevel = False
Panel1.Controls.Clear()
Panel1.Controls.Add(frmToDisplay)
frmToDisplay.Show()
frmToDisplay.Activate()
End Sub
End Class
Does anyone know id this is a bug with VB 2005 or am I doing
something
wrong?
THANKS
I just tried this and it works for me. I have SP1 installed, do you?
Feb 15 '07 #2

P: n/a
Hi thanks Yeah I do and it doesnt work could you try my project?

here is the link

http://www.motounlock.net/BigJohn/PanelTestWinForms.zip
But can you go to the textbox and select a part of the text using
mouse?

THX
On 15 Feb, 17:18, CodeMonkey <spamm...@suck.comwrote:
Brano wrote:
Hi I am using vb.net 2005 this is a windows application
I am using this functionality in another project I have created this
simple project to show the problem
Basically I have two forms:
Form1 - contains a panel (System.Windows.Forms.Panel)
Form2 - contains two textboxes with some sample text in them
If the Form2 is executed on its own the textboxes work fine you can
use your mouse to select a portion of the text and copy paste it
However if I run the Form2 in a panel in Form1 the functionality of
the textboxes is gone you can no longer use the mouse to select parts
of the text you can only souble click to select the whole contents of
the textbox.
this is the code I am using:
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim frmToDisplay As New Form2
frmToDisplay.TopLevel = False
Panel1.Controls.Clear()
Panel1.Controls.Add(frmToDisplay)
frmToDisplay.Show()
frmToDisplay.Activate()
End Sub
End Class
Does anyone know id this is a bug with VB 2005 or am I doing
something
wrong?
THANKS

I just tried this and it works for me. I have SP1 installed, do you?- Hide quoted text -

- Show quoted text -

Feb 15 '07 #3

P: n/a
Brano wrote:
Hi thanks Yeah I do and it doesnt work could you try my project?

here is the link

http://www.motounlock.net/BigJohn/PanelTestWinForms.zip
But can you go to the textbox and select a part of the text using
mouse?

THX

I downloaded your project and it does exactly what you say it does. I
cannot select text. I opened my project back up and verified it does
work correctly, however my project isn't like yours... I mistakingly
used all of our custom components. We use components from Developer's
Express... It's interesting, though. I took out one line of code to
enable form based skins, and it doesn't work right. If I put that line
of code back in, the mouse works correctly, even with the default
context menu.

I'm not sure what to tell you. Hopefully someone else will chime in with
some advice.
Feb 15 '07 #4

P: n/a
"Brano" <bp****@gmail.comschrieb
Hi I am using vb.net 2005 this is a windows application

I am using this functionality in another project I have created this
simple project to show the problem
Basically I have two forms:
Form1 - contains a panel (System.Windows.Forms.Panel)
Form2 - contains two textboxes with some sample text in them
If the Form2 is executed on its own the textboxes work fine you can
use your mouse to select a portion of the text and copy paste it
However if I run the Form2 in a panel in Form1 the functionality of
the textboxes is gone you can no longer use the mouse to select parts
of the text you can only souble click to select the whole contents of
the textbox.
this is the code I am using:
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim frmToDisplay As New Form2
frmToDisplay.TopLevel = False
Panel1.Controls.Clear()
Panel1.Controls.Add(frmToDisplay)
frmToDisplay.Show()
frmToDisplay.Activate()
End Sub
End Class
Does anyone know id this is a bug with VB 2005 or am I doing
something
wrong?
Form's inside other Forms is not supported, unless it's an MDI
application. Use Usercontrols instead.
Armin

Feb 16 '07 #5

P: n/a
Hi it is an MDI application the isMDIContainer property of the parent
form is set to true and I have even tried this

frmToDisplay.Parent = Me

Is there something I am missing to make it an MDI application?

Feb 19 '07 #6

P: n/a
Hi it is an MDI application the isMDIContainer property of the parent
form is set to true and I have even tried this

frmToDisplay.Parent = Me

Is there something I am missing to make it an MDI application?2005
this is a windows application

Feb 19 '07 #7

P: n/a
"Brano" <bp****@gmail.comschrieb
Hi it is an MDI application the isMDIContainer property of the
parent form is set to true and I have even tried this

frmToDisplay.Parent = Me

Is there something I am missing to make it an MDI application?2005
this is a windows application
Replace by:
frmToDisplay.MdiParent = Me

No need to change TopLevel property.
Armin

Feb 19 '07 #8

P: n/a
Yes if I do that there is no need to change the TopLevel property but
it still doesn't work you still cant select the contents of the
textbox by mouse.
On 19 Feb, 10:48, "Armin Zingler" <az.nos...@freenet.dewrote:
"Brano" <bpa...@gmail.comschrieb
Hi it is an MDI application the isMDIContainer property of the
parent form is set to true and I have even tried this
frmToDisplay.Parent = Me
Is there something I am missing to make it an MDI application?2005
this is a windows application

Replace by:
frmToDisplay.MdiParent = Me

No need to change TopLevel property.

Armin

Feb 22 '07 #9

P: n/a
"Brano" <bp****@gmail.comschrieb
Yes if I do that there is no need to change the TopLevel property
but it still doesn't work you still cant select the contents of the
textbox by mouse.
Because you wrote "frmToDisplay.parent = me" I assumed that you do not
execute "Panel1.Controls.Add(frmToDisplay)" anymore, because both at one
time doesn't make sense. But I guess you still try to put it into a panel in
the MDI container. You mustn't do this. The MDI Form must be put in the MDI
containers client area (by setting the MDIparent property).
Armin

Feb 22 '07 #10

P: n/a
Hi,

thanks for your help but I think you have misunderstood what I am
trying to do here.

The way you suggests it works and the textboxes are selectable (if I
use only MDIcontainer and make the form2 chid of it) but this isn't
what I was after at all

I need to use the panel control because I have in my main application
a treeview that I am using for navigation thru the application (this
is not included in this sample application)

So regardles of the MDI my problem is that once the form is added to
the panel using this statements:

Panel1.Controls.Add(frmToDisplay)

The textboxes on the form are no longer selectable by mouse.

I understand your point about the MDI forms but this is not what I am
after as I need to use the fuctionality of the panel...
Feb 22 '07 #11

P: n/a
"Brano" <bp****@gmail.comschrieb
Hi,

thanks for your help but I think you have misunderstood what I am
trying to do here.

The way you suggests it works and the textboxes are selectable (if I
use only MDIcontainer and make the form2 chid of it) but this isn't
what I was after at all

I need to use the panel control because I have in my main
application a treeview that I am using for navigation thru the
application (this is not included in this sample application)

So regardles of the MDI my problem is that once the form is added to
the panel using this statements:

Panel1.Controls.Add(frmToDisplay)

The textboxes on the form are no longer selectable by mouse.

I understand your point about the MDI forms but this is not what I
am after as I need to use the fuctionality of the panel...
I did undestand what you are trying, but I was trying to tell you that you
can not put Forms inside other Forms unless it's an MDI child form inside a
MDI container. I meant directly inside as a MDI child. If you put the Form
into a panel, it's not an MDI child anymore. As you see now, your approach
creates side effects because this is not supported.
Armin

Feb 22 '07 #12

P: n/a
So you are saying that putting a form into a panel is not supported? I
think this is a bug in visual studio more than anything because you
either should not be able to do it at all or it should work without
side effects (bugz) anyone from MS to comment on this?

Feb 23 '07 #13

This discussion thread is closed

Replies have been disabled for this discussion.