How to bind database to menu strip in windows form application?
I want to create dynamic menus in windows application?
plz help me....
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dorababu MekaRank #457 · 5.5K reputationPosted Sep 14, 2012, 10:14 PM EDT
tblMenu shoud be like this
mnuID
Description
10
File
20
Edit
Create tblsubMenu as follows
MenuText
10
New
10
Open
20
Cut
20
Copy
if you need you can add more
I used Mysql database you can change it to SQL if you are using SQL
check out my attachment of code inorder to find database driven menus..
Dorababu MekaRank #457 · 5.5K reputationPosted Sep 14, 2012, 5:09 AM EDT
In page load get all your necessary connections and required fields from database
if(datareader.HasRows)
{
MenuStrip menu=new MenuStrip();
menu.Items.Add(datareader[0].Tostring());
}
Try some thing like this you can also assign dataset values as per we did for combo box binding or grid binding in asp.net.
Satyapriya NayakRank #47 · 31.5K reputationPosted Sep 14, 2012, 8:43 AM EDT
Pravinkumar BirajdarRank #4,618 · 334 reputationPosted Sep 14, 2012, 6:34 PM EDT
Dorababu MekaRank #457 · 5.5K reputationPosted Sep 14, 2012, 7:18 PM EDT
Pravinkumar BirajdarRank #4,618 · 334 reputationPosted Sep 14, 2012, 8:56 PM EDT
Pravinkumar BirajdarRank #4,618 · 334 reputationPosted Sep 15, 2012, 4:17 AM EDT
But plz can you tell me that how to add form name object to each menu so that it can be opened at click event
Dorababu MekaRank #457 · 5.5K reputationPosted Sep 15, 2012, 5:11 AM EDT
Pravinkumar BirajdarRank #4,618 · 334 reputationPosted Sep 15, 2012, 5:31 AM EDT
Pravinkumar BirajdarRank #4,618 · 334 reputationPosted Sep 17, 2012, 4:01 AM EDT
Dorababu MekaRank #457 · 5.5K reputationPosted Sep 18, 2012, 3:35 AM EDT
Form1 f1 = new Form1();
f1.ShowDialog(); or f1.Show();
Pravinkumar BirajdarRank #4,618 · 334 reputationPosted Sep 19, 2012, 7:31 PM EDT
Dorababu MekaRank #457 · 5.5K reputationPosted Sep 20, 2012, 3:29 AM EDT
Pravinkumar BirajdarRank #4,618 · 334 reputationPosted Sep 20, 2012, 5:37 AM EDT