[2005] Contextmenustrip - One function to rule them all
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: [2005] Contextmenustrip - One function to rule them all

Threaded View

  1. #1
    Join Date
    May 2007
    Posts
    5

    Resolved [RESOLVED] [2005] Contextmenustrip - One function to rule them all

    Hi,

    This is my first post and i'm quite new to VB2005 so hopefully i'll explain what i'm after properly.

    Basically i'm creating a single contextmenu for each of the text boxes I have on a form. Most of the contextmenu will be populated with text which when the user selects it, is set in the textbox which used the contextmenu.

    Now I can do the contextmenu, thats fine and populate it with the data, the problem i'm having is telling the textbox to display the text the user has selected on the contextmenu.

    I'm using sourcecontrol to find out which textbox fired the contextmenu but once one of the items is selected nothing is displayed in the textbox. I have also tried it with a msgbox to try and see whats going on but nothing is displayed in that also.

    Here's a quick sample to show what i'm trying to do:

    Code:
    Private Sub ContextMenuStrip_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ContextMenuStrip.Click
    
            If ContextMenuStrip.SourceControl Is TextBox1 Then
    
                TextBox1.Text = ContextMenuStrip.Text
    
            ElseIf ContextMenuStrip.SourceControl Is TextBox2 Then
                TextBox2.Text = ContextMenuStrip.Text
    
            End If
        End Sub
    What I would eventually like to do is write just one function which finds which textbox fired the contextmenu and then set its text to that of the chosen menuitem on the contetmenu.


    I really appreciate any help someone can give me.


    MadCat
    Last edited by madcat1981; May 29th, 2007 at 12:06 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center