Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Calling Events Dynamically In VB.net

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 03-02-2010
Member
 
Join Date: Nov 2009
Posts: 117
Calling Events Dynamically In VB.net
  

Hello, I am learning VB.net programming and currently I am searching for the program or code which can help me call the events Dynamically. I have searched on internet, but not find anything useful. So, if anyone is having solution for it, then please provide me solution for it. I will be thankful to you.

Reply With Quote
  #2  
Old 03-02-2010
Member
 
Join Date: May 2008
Posts: 2,384
Re: Calling Events Dynamically In VB.net

Hello, I have a code which will simply provide you help for getting solution for dynamic button event. Check it whether it is important for your or not.
Code:
 $(input.classbouton).click(function() 
{ 
    / / Use here $ (this) to have a jquery instance that represents the button.
    / / Example:
    alert( $(this).attr('id') ); / / Displays the ID attribute of the button clicked
  });
Reply With Quote
  #3  
Old 03-02-2010
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: Calling Events Dynamically In VB.net

Must add your button to the form. It may be only way to solve your problem. So, just take look at the code below and you will able to get the solution for it.
Code:
this.Controls.Add (this.button );

this.button. Click + = new System.EventHandler (this.button_CLICK);

private void button_CLICK (Object sender, System.EventArgs e)
        {
/ / Action
        }
Reply With Quote
  #4  
Old 03-02-2010
Member
 
Join Date: Feb 2008
Posts: 1,848
Re: Calling Events Dynamically In VB.net

Hey, I have done following for it.
I first started doing:
Code:
var onclick = document.createAttribute("onclick");
onclick.nodeValue = "myFunction ()";
document.getElementById('myElement').setAttributeNode(onclick);
Then in the coding I have changed the following:
Code:
try {
  document.getElementById('myElement').attachEvent(myFunction,true)
} catch (e) {
  var onclick = document.createAttribute("onclick");
  onclick.nodeValue = "myFunction ()";
  document.getElementById('myElement').setAttributeNode(onclick);
}
And at last my code is as following :
Code:
/ / set my settings
document.getElementById('myElement').onclick = function onsenfou (event) {
  myFunction(mesParamètres);
};
Reply With Quote
  #5  
Old 03-02-2010
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: Calling Events Dynamically In VB.net

I am not having knowledge about the vb.net. but, I have got the code below which will help you to create a menuitem dynamically. I think the logic of it will be helpful to you for calling the events dynamically.
Code:
private void menu_Selection_Select (object sender, EventArgs e)
        {
this.m_selection_materiel.MenuItems.Clear ();
Am ArrayList = new ArrayList (); / / am for array_materiel
           
MenuItemExtend mnu;

foreach (ListViewItem mon_item in list_Liste_Fichiers.Items)
            {
if (! am.Contains (mon_item.SubItems [6]. Text))
                {
am.Add (mon_item.SubItems [6]. Text);
                }
            }
am.Sort ();
foreach (string material in am)
            {
mnu = new MenuItemExtend ();
mnu.Text = material;
mnu.Tag = material;
mnu.Click + = new EventHandler (mnu_Click);
this.m_selection_materiel.MenuItems.Add (mnu);
            }
        }

protected void mnu_Click (object sender, EventArgs e)
        {
selectionner_par_materiel ((string) ((MenuItemExtend) sender). Tag);
        }

        private void selectionner_par_materiel (string material)
        {
foreach (ListViewItem mon_item in list_Liste_Fichiers.Items)
            {
if (mon_item.SubItems [6]. == Text material)
                {
mon_item.Checked True =;
                }
            }
        }

public class MenuItemExtend: menuItem
{
private object tag;
public object Tag
    {
get (return tag;)
set (tag = value;)
    }
}
Reply With Quote
  #6  
Old 03-02-2010
Member
 
Join Date: May 2008
Posts: 2,008
Re: Calling Events Dynamically In VB.net

If you want to implement the event then you must need to follow the procedure of the steps below:
  • First thing you need to do is the declaration of the delegate.
  • Then you need to provide the event signature and for that you can make use of the Event keyword.
  • Then you can handle that event by declaring an event handler.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Calling Events Dynamically In VB.net"
Thread Thread Starter Forum Replies Last Post
How to calculate value dynamically in JavaScript? KAIRU26 Software Development 5 24-02-2010 11:01 PM
Not able to Include files dynamically in ASP DANIEL 602 Software Development 4 03-02-2010 01:32 AM
Dynamically Loading a C# DLL Allan.d Software Development 3 23-11-2009 07:54 AM
How to set the maxlength of the textboxes dynamically Sophia Software Development 3 18-03-2009 01:00 AM
How to add forms Dynamically with JavaScript Neil'o Software Development 3 12-03-2009 02:12 PM


All times are GMT +5.5. The time now is 05:31 AM.