Results 1 to 7 of 7

Thread: MenuBar Manipulation

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2009
    Posts
    429

    MenuBar Manipulation

    hi,

    I want to know to how to delete duplicate items in menubar?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: MenuBar Manipulation

    Why does this menu have duplicate items in the first place? Wouldn't it make more sense not to add them to begin with rather than removing them afterwards?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2009
    Posts
    429

    Re: MenuBar Manipulation

    actually when form loads i will create menus based on data present in Database.. when user edits that data, at that time i want to update the edited/Newly added data in Menu bar.. really confused in this silly thing..

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: MenuBar Manipulation

    It's fairly simple. Before you add a menu item you test to see whether a matching item already exists and you just don't add one if it does. To do that you might loop through the existing items and test the Text property of each or whatever, or you might keep a list of the existing data elsewhere for easier access. It depends on your preference and the specific circumstances. You've only given us a very vague description of the circumstances so I can't really say more than that.
    Quote Originally Posted by yogesh12 View Post
    really confused in this silly thing..
    The most common cause for confusion in beginners (and others) is that they start trying to write code before they even know what the code is supposed to do. That's just never going to work. You need to work out the logic first, then write code to implement that logic. You should start out asking yourself how you would go about performing the task manually, say with pen and paper or with physical objects. Once you've got a set of steps that you can run through physically and get the correct result, only then should you consider writing any code. At that point you can write code to specifically implement the steps you worked out before, so you know exactly what your code is supposed to do and the opportunities for confusion are reduced dramatically.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2009
    Posts
    429

    Re: MenuBar Manipulation

    Quote Originally Posted by jmcilhinney View Post
    It's fairly simple. Before you add a menu item you test to see whether a matching item already exists and you just don't add one if it does. To do that you might loop through the existing items and test the Text property of each or whatever, or you might keep a list of the existing data elsewhere for easier access. It depends on your preference and the specific circumstances. You've only given us a very vague description of the circumstances so I can't really say more than that.The most common cause for confusion in beginners (and others) is that they start trying to write code before they even know what the code is supposed to do. That's just never going to work. You need to work out the logic first, then write code to implement that logic. You should start out asking yourself how you would go about performing the task manually, say with pen and paper or with physical objects. Once you've got a set of steps that you can run through physically and get the correct result, only then should you consider writing any code. At that point you can write code to specifically implement the steps you worked out before, so you know exactly what your code is supposed to do and the opportunities for confusion are reduced dramatically.

    Great Advice sir... along with this can u show a piece of code which will check through the items?

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: MenuBar Manipulation

    What exactly is the source data? What exactly constitutes a duplicate?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2009
    Posts
    429

    Re: MenuBar Manipulation

    i have two form, form_main is main form, in load even of main form i am extracting data from db and creating menu items and adding them.. i have another form which is used to edit/Add new data... when form loads i am calling a fucntion which adds menu itms from db.. and in another for Config_items i am probiding user to edit/add data.. after editing or adding data i want to update DB (which i can do) and want to update form_main`s menubar..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width