Frage

I have a number of forms in a project that appear depending on who uses the application. What I am trying to do is have a ContextMenuStrip (that runs on a NotifyIcon) that adds the forms accessible to the ContextMenuStrip, so that you can select them and have them appear should they not be visible.

At the moment, all the forms are made up as so:

WithEvents tSi1 As New ToolStripMenuItem()
Sub...
.
.
.
'Case select to check user + get correct form
.
.
.
FormX.Text = fName & " " & lName & "'s Menu"
tSi1.Text = fName & " " & lName & "'s Menu"
Me.CMS1.Items.Add(tSi1)
.
.
... End Sub

Private Sub tSi1_Click(ByVal sender As Object, ByVal args As EventArgs) Handles tSi1.Click
'What goes here?
End Sub

So whatever happens, the form I will be using will be of the form fName & " " & lName & "'s Menu". How can I set that in the Click argument for the form?

War es hilfreich?

Lösung

Just had momentary vision of clarity while having a brief break.

I can set a public variable of Public formX as Form and then just set formX in my Select Case statement, then I can just reference formX from there onwards.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top