Click here to Skip to main content
16,006,749 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How to open word or notepad from the vb.net link? Pin
PranjalSharma12-Sep-05 19:21
PranjalSharma12-Sep-05 19:21 
GeneralRe: How to open word or notepad from the vb.net link? Pin
Anonymous12-Sep-05 19:35
Anonymous12-Sep-05 19:35 
GeneralRe: How to open word or notepad from the vb.net link? Pin
Anonymous12-Sep-05 20:29
Anonymous12-Sep-05 20:29 
GeneralRe: How to open word or notepad from the vb.net link? Pin
PranjalSharma12-Sep-05 21:15
PranjalSharma12-Sep-05 21:15 
GeneralRe: How to open word or notepad from the vb.net link? Pin
Anonymous12-Sep-05 23:05
Anonymous12-Sep-05 23:05 
QuestionHow to name an user-defined range into a excel file using .net language?? Pin
hustsay2312-Sep-05 17:13
hustsay2312-Sep-05 17:13 
QuestionContext Menus and Indexes Pin
No-e12-Sep-05 10:00
No-e12-Sep-05 10:00 
AnswerRe: Context Menus and Indexes Pin
Luis Alonso Ramos12-Sep-05 10:54
Luis Alonso Ramos12-Sep-05 10:54 
You have to use an array of MenuItems. I don't know the exact VB.NET syntax, so I'll give you some C# code. Hopefully, you'll be able to understand it:
// In the class, declare an array field
MenuItem[] contextItems;
 
 ...
 
// In the constructor, or wherever you build your menu
// First create the array
contextItems = new MenuItem[2];  // Two items
 
// Create all the menu items and put them in the array
contextItem[0] = new MenuItem();
contextItem[0].Text = "Menu Item 1";
contextItem[1] = new MenuItem();
contextItem[1].Text = "Menu Item 2";
 
// Set up the same handler for every item
foreach(MenuItem item in contextItems)
    item.Click += new EventHandler(ContextOnClick);
 
 ...
 
// The Click handler - the same for every item
void ContextOnClick(object sender, EventArgs e)
{
    // Check the array to find the index of the item that was clicked
    int index = -1;
    for(int i = 0; i < contextItem.Length; i++)
        if(contextItems[i] == sender)
            index = i;
 
    if(index >= 0)
    {
        // Act on item i
    }
}
I hope this helps!

-- LuisR



Luis Alonso Ramos
Intelectix - Chihuahua, Mexico

Not much here: My CP Blog!


The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005

-- modified at 16:55 Monday 12th September, 2005
AnswerRe: Context Menus and Indexes Pin
Briga12-Sep-05 22:12
Briga12-Sep-05 22:12 
GeneralRe: Context Menus and Indexes Pin
No-e13-Sep-05 4:38
No-e13-Sep-05 4:38 
GeneralRe: Context Menus and Indexes Pin
Briga15-Sep-05 23:32
Briga15-Sep-05 23:32 
QuestionINSERT INTO database Pin
daviiie12-Sep-05 9:08
daviiie12-Sep-05 9:08 
AnswerRe: INSERT INTO database Pin
Dave Kreskowiak12-Sep-05 10:04
mveDave Kreskowiak12-Sep-05 10:04 
GeneralRe: INSERT INTO database Pin
daviiie12-Sep-05 12:33
daviiie12-Sep-05 12:33 
GeneralRe: INSERT INTO database Pin
Christian Graus12-Sep-05 12:51
protectorChristian Graus12-Sep-05 12:51 
AnswerRe: INSERT INTO database Pin
KaptinKrunch12-Sep-05 14:32
KaptinKrunch12-Sep-05 14:32 
QuestionForm Loading Pin
No-e12-Sep-05 8:06
No-e12-Sep-05 8:06 
AnswerRe: Form Loading Pin
Dave Kreskowiak12-Sep-05 9:43
mveDave Kreskowiak12-Sep-05 9:43 
AnswerRe: Form Loading Pin
namazikhah12-Sep-05 9:51
namazikhah12-Sep-05 9:51 
QuestionDataBinding in VB 2005 Pin
watagal12-Sep-05 7:46
watagal12-Sep-05 7:46 
Questionprint a webpage in vb.net Pin
jelsner12-Sep-05 7:45
jelsner12-Sep-05 7:45 
AnswerRe: print a webpage in vb.net Pin
Dave Kreskowiak12-Sep-05 9:52
mveDave Kreskowiak12-Sep-05 9:52 
QuestionErl in VB.NET Pin
maroche12-Sep-05 6:49
maroche12-Sep-05 6:49 
AnswerRe: Erl in VB.NET Pin
Dave Kreskowiak12-Sep-05 8:02
mveDave Kreskowiak12-Sep-05 8:02 
QuestionFile Sharing Violation Problem - Remoting Pin
PranjalSharma12-Sep-05 2:36
PranjalSharma12-Sep-05 2:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.