I have done the same, but problem still seems to exists. As soon as my
stylus hits the screen, my screen closes. I think my event is still pending.
It resumes when stylus hits the ground. Is there any way to explicity call
"W.G. Ryan eMVP" wrote:
> Ok, so there's something going on in between popup and close...
>
> Anyway, I have form1, Form2 and form3. On form2 I have a listView with an
> empty context menu. When form1 loads I declare a new Form2 and show it. On
> Popup on Form2 I have the following code:
> Dim f3 As New Form3
>
> Select Case f3.ShowDialog
>
> Case DialogResult.OK
>
> Me.Close()
>
> End Select
>
> On Form3 I stuck this behind a button just to get it to close ---
>
> Me.DialogResult = DialogResult.OK
>
>
>
> I've run it on my iMATE and a iPAQ 1940 as well as the emulator, it works as
> expected each time. You may want to try Application.DoEvents because it's
> possible that your screen just isn't refreshing although I doubt it. I
> can't seem to replicate the behavior
>
>
> --
> W.G. Ryan MVP (Windows Embedded)
>
> TiBA Solutions
>
www.tibasolutions.com |
www.devbuzz.com |
www.knowdotnet.com > "Mohit Gupta" <MohitGupta@discussions.microsoft.com> wrote in message
> news:F34E0831-54A5-48C0-8634-DAC9F4AED383@microsoft.com...
> > HI Ryan
> >
> > Actually, let me explain what I am doing.
> >
> > THere is a LISTVIEW object in an application that has, for example, 10
> rows.
> > Now, as I am developing on .NET CF framework, which in other words means
> an
> > applicaiton is developed for Pocket PC. Therefore, what I want to do is to
> > hold the stylus on to the item until context menu popup event is fired.
> >
> > For that reason I created a new ContextMenu object having no menu items in
> > it. I assigned this context menu to LISTVIEW object. Without any problems,
> > context menu popup is fired when I hold my stylus for longer period of
> time
> > on the selected item.
> >
> > For more information, every item has an ID associated (in this example)
> with
> > it. When an item is selected and context menu pop up is fired, I pass that
> ID
> > to the next form that I show as a dialog box. Once the form dialog if
> closed,
> > I come back to my context menu popup function and want to close the parent
> > window. But when I try to close it nothing happens until stylus touches
> the
> > screen.
> >
> > Bit for more code
> >
> >
> > Private Sub ContextMenu1_Popup(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles ContextMenu1.Popup
> > Dim formObj As New Form2
> > formObj.setValues(ListView1.selectedItem(0).text)
> > formObj.showDialog() 'Perform some task and close it
> > 'After the dialog form is closed, close this window as well.
> > Me.Close() 'The window does not closes. Don't know why
> > End Sub
> >
> > I think now you have more idea of what I am trying to do. Definitely there
> > is another way, if you are thinking about it, for example, have a button
> and
> > perform the same task when the button is clicked. I have already been
> > successful that way but I want to resolve the above mentioned issue.
> >
> >
> >
> > "W.G. Ryan eMVP" wrote:
> >
> > > Mohit:
> > >
> > > I'm not sure I follow what you're trying to do. Popup is triggered
> right
> > > before the menu is shown. As such, why would you want to close the form
> > > it's based on before it's shown - nothing could be selected if you could
> > > successfully close it. If you do it successfully I'm pretty cure you're
> > > going to raise an exception - b/c you can't access a disposed object.
> You
> > > don't know for sure exactly the sequence that will fire but close is
> going
> > > to call dispose so the sender won't exist.
> > >
> > > --
> > > W.G. Ryan MVP (Windows Embedded)
> > >
> > > TiBA Solutions
> > >
www.tibasolutions.com |
www.devbuzz.com |
www.knowdotnet.com > > > "Mohit Gupta" <MohitGupta@discussions.microsoft.com> wrote in message
> > > news:34222998-181F-493C-BEB3-D9EF4C103610@microsoft.com...
> > > > Hi all,
> > > >
> > > > Lately I have been working on an application in VB .net CF for
> Pocket PC
> > > > device. I have a small question about Context Menu.
> > > >
> > > > When I try to close the window after context menu is poped up, the
> window
> > > > does not closes until I click on the window. Below is the code.
> Hopefully,
> > > > you can help me out.
> > > >
> > > >
> > > > Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu
> > > > -----Remember ContextMenu1 has no menu items added.---------
> > > > 'Setting context menu for the listview. When user holds the mouse
> on
> > > the
> > > > listview item, then context menu pop up event is fired. Look below to
> see
> > > the
> > > > code
> > > > Me.ListView1.ContextMenu = Me.ContextMenu1
> > > >
> > > > Private Sub ContextMenu1_Popup(ByVal sender As System.Object,
> ByVal e
> > > As
> > > > System.EventArgs) Handles ContextMenu1.Popup
> > > > Me.Close() 'The window does not closes. Don't know why
> > > > End Sub
> > > >
> > > > Your help will be appreciated
> > > >
> > > >
> > >
> > >
> > >
>
>