Help With My Project

Thesolis

Member
Joined
Apr 22, 2009
Messages
16
Programming Experience
1-3
Hello, I'm new here.

I'm here for help with something, a project I thought I would start.
It is small, but I thought it would be fun to program.

Basically, I'm going for a program that has a NotifyIcon and a ContextMenuStrip
working together to create a program launcher.

I began by adding all the necessary controls and setting the properties.
Next I set up StreamReader for a text file I will be using to save program paths.

This brought me to problem one.
StreamReader and individual lines of text.
I'm essentially in the dark in this area, and for my program, I'm aiming for the NotifyIcon's ContextMenuStrip's buttons(Long title) to display the names or paths of the program. So I need to add individual lines to each button.

I thought I would come back to that, so I moved on to the next thing, adding buttons to the ContextMenuStrip.
I have buttons already in place, like Add Program, Remove Program and Programs(for the actual list) but I need to be able to add buttons to those.
Kind of like sub-buttons.

If that didn't make any sense, I mean like when you hover your mouse over a button and another menu pops up.


Well, thanks for reading.
Any responses would be appreciated.
 
Here's some help with the context menu

VB.NET:
Expand Collapse Copy
Private Sub AddToProgramContextMenu()

        'make a new context menu strip
        ' this will be the sub items
        Dim cmsNew As New ContextMenuStrip()

        ' fill the items of the context menu strip
        Dim tempToolStripMenuItem As ToolStripMenuItem
        
        'Loop for adding items to the sub menu
        For intCnt As Integer = 0 To 4
            'make the new toolstipmenu item to add to the new context menu strip
            tempToolStripMenuItem = New ToolStripMenuItem("prgram " & intCnt.ToString(), Nothing, AddressOf ToolStripButtonClick, "mnuProgram" & intCnt.ToString())
            ' add the tag item that will be used in the click event 
            tempToolStripMenuItem.Tag = "menu"
            cmsNew.Items.Add(tempToolStripMenuItem)
        Next

        'this is the item that shows in the main context menu.
        Dim tempItem As New ToolStripMenuItem("Program List", Nothing, Nothing, "mnuProgramList")

        'add the item to the main context menu
        cmsMainContext.Items.Add(tempItem)

        'set the direction the new sub menu is to open
        tempItem.DropDownDirection = ToolStripDropDownDirection.Right

        'add the new sub menu to the item in the main context menu
        tempItem.DropDown = cmsNew

    End Sub

I used the following link to help me with this
ContextMenuStrip Class (System.Windows.Forms)
 
Back
Top