Toolstripproblem
VB .net 2012Windows form hvor jeg dynamisk opretter underpunkter til en toolstripdropdownbutton.
Fungerer fint ...undermenuerne tilføjes som ønsket men MEN hvordan "eksekverer" jeg underpunkterne. F.eks start et program når første menupunkt klikkes?
Private Sub FillStandardTekst()
Dim Connection As New SqlConnection(Conn)
Connection.Open()
' you dont need to open/close the connection with a DataAdapter '
Dim reader As SqlDataReader
Dim Tid As DateTime, Notat As String, Læge As String, Sekretær As String
Dim cmd As SqlCommand
cmd = New SqlCommand("SELECT Overskrift, Tekst FROM StandardTekst WHERE BrugerID = @BrugerID", Connection)
With cmd
.Parameters.Add("@BrugerID", SqlDbType.NChar, 20)
.Parameters("@BrugerID").Value = "ssa"
.ExecuteNonQuery()
End With
reader = cmd.ExecuteReader()
Do While reader.Read
If Not reader.IsDBNull(0) Then
Me.ToolStripDropDownButton1.DropDownItems.Add(reader.GetString(0).ToString)
End If
Loop
End Sub