Dim MainMenu As New MenuStrip
Dim ParentMenu, ChildMenu, ChildMenu2 As ToolStripMenuItem
Dim MenuKode, MenuLabel As String
Sub MenuAkses()
cSelect("SELECT * FROM kode_menu WHERE menu_group = '" & LoginLevel & "' " & _
"ORDER BY menu_kode ASC ")
Do While rdr.Read
MenuKode = rdr.Item("menu_kode")
MenuLabel = rdr.Item("menu_label").ToString
If Len(MenuKode) = 4 Then
Dim MenuItem As New ToolStripMenuItem(MenuLabel)
ParentMenu = MenuItem
End If
If Len(MenuKode) = 6 Then
If MenuLabel <> "-" Then
Dim MenuItem As New ToolStripMenuItem(MenuLabel)
ChildMenu = MenuItem
ParentMenu.DropDownItems.Add(ChildMenu)
Else
ParentMenu.DropDownItems.Add(New ToolStripSeparator)
End If
End If
If Len(MenuKode) = 8 Then
If MenuLabel <> "-" Then
Dim MenuItem As New ToolStripMenuItem(MenuLabel)
ChildMenu2 = MenuItem
ChildMenu.DropDownItems.Add(ChildMenu2)
Else
ChildMenu.DropDownItems.Add(New ToolStripSeparator)
End If
End If
MainMenu.Items.Add(ParentMenu)
Loop
rdr.Close()
Me.Controls.Add(MainMenu)
End Sub
Load Menu From Database
Langganan:
Posting Komentar (Atom)
0 comments:
Posting Komentar