so I'm having some trouble with opening the tab to where I want to drag some data.
I have 2 child MDI forms, with both a listview.
I would like to drag a listviewitem from mdichild 1 to mdichild 2.
The problem is that I am not able to find the correct event that makes it possible to SHOW the second form when I drag my data to the corresponding MDI tab.
Right now the only thing I get when I drag data to a MDI tab is the standard black circle with a stripe through it.
Any ideas on how to open the tab?
All help is appreciated
It is difficult to tell without code where you problem is, but could it be as simple as this?
Private Sub MDIChildForm_DragEnter(sender As System.Object, e As _
System.Windows.Forms.DragEventArgs) Handles MyBase.DragEnter
Me.Activate()
Me.WindowState = FormWindowState.Normal
End Sub
This will un-minimize and activate the child form when you drag over it. This is assuming your "Tab" is a minimized MDI child form...
Related
I have a form (we'll call it Form A) that contains a ListView control. When I select an item in the ListView, the event handler creates and shows a Form B.
I want Form B to appear in front of Form A. Both forms are maximized when shown. The problem is, the ListView in Form A is making Form A take the focus back right after Form B is shown. The screen flickers temporarily, so Form B is initially in front. I know it's the ListView doing it because if I open Form B from another control, it works as intended.
I'm displaying Form B with Show(). Changing it to ShowDialog() fixes the problem, but I don't want it to be modal.
This is happening during the handler for the ListView1.ItemSelectionChanged event, and changing to ListView1.SelectedIndexChanged doesn't help.
Some code, if it makes it any clearer:
Private Sub ListView1_ItemSelectionChanged(sender As Object, e As ListViewItemSelectionChangedEventArgs) Handles ListView1.ItemSelectionChanged
If e.IsSelected Then
Dim my_form As New MyForm
my_form.Show()
End If
End Sub
Set the ListViews Activation Property to "OneClick", then handle the ItemActivate Event and display your Form from there.
I am developing a POS in vb.net and want to use Enter key as tab. this works well in controls other than button. e.g when the focus is on textbox or combobox etc then it works good but if the focused control is button then it does not move to next control. Help me by fixing this problem, I have searched alot but could not find any solution regarding this.
thanks
Regards
Muhammad Irfan Sumra
Enter key for button have default behavior which raise Click event.
You can handle Click event for moving focus to next control, and use MouseClick event for your click logic
Private Sub MyButton_Click() Handles MyButton.Click
SendKeys.Send("{TAB}")
End Sub
Private Sub MyButton_MouseClick() Handles MyButton.MouseClick
' Do your click logic
End Sub
At the moment, I have a project I'm working on with a menu that opens a new window. Annoyingly, when the new window is opened, it just does everything the main parent window does that the new window is opened up from. I want to be able to have the new window be able to do it's own thing and not just share what ever the parent is doing. Is there anything I can do at a button's click to give this form some kind of attribute that disallows this?
You can use seperate form. the working of each form will depend on what you specified in that particular form.. You can use the MDI form. and call all child forms under the mdi form. the child form will open in seperate window under MDI form.
you can simply call the child form as
Private Sub MembersToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MembersToolStripMenuItem.Click
Dim xfrm As New childForm
xfrm.MdiParent = Me
xfrm.Show()
End Sub
anybody have an idea how to write a code if the user clicks outside windows form, the form will automatically close? I.e., I had two forms, when i show form2 and then i click outside of it, form 2 will closed.
Does this help? Try the first two solutions, one of which should work for you.
Winforms: Close modal dialog when clicking outside the dialog
You can simply utilize the LostFocus built-in event of the Form like this
Private Sub Form1_LostFocus(ByVal sender As Object, ByVal e As EventArgs) _
Handles Me.LostFocus
Me.Close()
End Sub
I have an MDI application which contains many child forms
My problem is, on clicking a particular menu, I am opening a form with maximize window in the MDI form. This works fine.
Now if I open another form above the first one, and if i want the second form to be of normal size, i am unable to do it.
Second form also opens with maximized window similar to first one. I want the second form to be of normal small size.
I want to show second form normally and first form maximized.
How can i do that?
Private Sub TESTToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles TESTToolStripMenuItem.Click
Dim f As New newCalendar2("UGHARANI")
f.Show()
f.MdiParent = Me
f.WindowState = FormWindowState.Maximized
End Sub
Okay, I think I understand what you're trying to accomplish: you want the first (data) form to be a kind of background to your MDI application and have the other forms display on top of it, right?
Well one way to do it might be to remove borders from the background form –FormBorderStyle = None– and fill-dock it in the MDI parent form. Although it would end up coming to the fore and hiding all your other forms if a user clicked anywhere on it. But if it doesn't require any user interaction you could always use its Activate event to send it back to the background, using Me.SendToBack().