dynamic main menu

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • varun kanwar

    #1

    dynamic main menu

    ok i tell u in detail.

    database is:

    menu_bar option_no menu_option
    1 0 a
    2 1 b
    3 2 c
    4 2 d
    5 1 e
    6 1 f
    7 0 g
    8 7 h
    9 7 i
    10 9 j
    11 9 k
    12 7 l


    my coding is:

    Dim mainMenu1 As New MainMenu
    Dim menuItem As New MenuItem

    conn.Open()
    cmd.CommandText = "select * from user_profile where
    option_no=0"
    cmd.Connection = conn
    dr = cmd.ExecuteRead er
    While dr.Read
    menuItem.Text = Convert.ToStrin g(dr(1))
    mainMenu1.MenuI tems.Add(menuIt em.Text)
    End While

    dr.Close()
    conn.Close()
    Menu = mainMenu1


    and output should be:

    a g
    |->b |->h
    . |->c |->i
    . |->d . |->j
    |->e . |->k
    |->f |->l


    this code adds "a" and "g" but i m unable to add rest of child and sub
    child items.
    i have shown u the database hope u can generate dynamic main menu from
    there as output is required.

  • tomb

    #2
    Re: dynamic main menu

    You are only selecting 'a' and 'g' when you restrict your record
    selection with "where option_no = 0".
    Where are the sub-menus for 'a' and 'g' supposed to come from?

    T

    varun kanwar wrote:
    >ok i tell u in detail.
    >
    >database is:
    >
    >menu_bar option_no menu_option
    1 0 a
    2 1 b
    3 2 c
    4 2 d
    5 1 e
    6 1 f
    7 0 g
    8 7 h
    9 7 i
    10 9 j
    11 9 k
    12 7 l
    >
    >
    >my coding is:
    >
    Dim mainMenu1 As New MainMenu
    Dim menuItem As New MenuItem
    >
    conn.Open()
    cmd.CommandText = "select * from user_profile where
    >option_no=0"
    cmd.Connection = conn
    dr = cmd.ExecuteRead er
    While dr.Read
    menuItem.Text = Convert.ToStrin g(dr(1))
    mainMenu1.MenuI tems.Add(menuIt em.Text)
    End While
    >
    dr.Close()
    conn.Close()
    Menu = mainMenu1
    >
    >
    >and output should be:
    >
    a g
    |->b |->h
    . |->c |->i
    . |->d . |->j
    |->e . |->k
    |->f |->l
    >
    >
    >this code adds "a" and "g" but i m unable to add rest of child and sub
    >child items.
    >i have shown u the database hope u can generate dynamic main menu from
    >there as output is required.
    >
    >
    >

    Comment

    • varun kanwar

      #3
      Re: dynamic main menu


      cmd.CommandText = "select * from user_profile"

      ok llets change the command to this but even then how will i
      distinguish between parent menu and child menu.

      and big problem is where to right code to add child menu to parent menu.

      Comment

      Working...