.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Post New Web Links

add event handler in runtime

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :Windows Application
 

Hi,

I have a button and a richtextbox on the my form.  Pressing the button will start an external process and the standard output is captured to the richtextbox.

Here below is the code I downloaded and modified. 

Public Class Form1
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim p As New Process
    p.StartInfo.FileName = "ping.exe"
    p.StartInfo.Arguments = "www.bbc.co.uk"
    p.StartInfo.UseShellExecute = False
    p.StartInfo.RedirectStandardOutput = True
    p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
    AddHandler p.OutputDataReceived, AddressOf Monitor
    AddHandler p.Exited, AddressOf Finished
    p.Start()
    p.BeginOutputReadLine()
  End Sub

  Sub Monitor(ByVal sender As Object, ByVal e As DataReceivedEventArgs)
    UpdateTextBox(e.Data)
  End Sub

  Private Delegate Sub UpdateTextBoxDelegate(ByVal Text As String)
  Private Sub UpdateTextBox(ByVal Tex As String)
    If Me.InvokeRequired Then
      Dim del As New UpdateTextBoxDelegate(AddressOf UpdateTextBox)
      Dim args As Object() = {Tex}
      Me.Invoke(del, args)
    Else
      RichTextBox1.Text &= Tex & Environment.NewLine
    End If
  End Sub

  Private Sub Finished(B


View Complete Post


More Related Resource Links

Creating Event Handler in Code behind

  

Hi, so I have a control that is created in the code behind and generates fine but I can't figure out how to create an event handler for it.  I've found plenty of examples for it in C sharp, but none of them seem to apply to VB.  What I want to do is essentially this:

myDropDownList.SelectedIndexChanged = "Event to do here"

but it doesn't seem to work for me.

Any suggestions are appreciated.



want to launch modal Popup from created User Event handler

  

hi,

 

I have a create user wizard on my page and in the event handler (Created User) I get extra information from the user

via textboxes within the aspx etc.

 

I then do a response.redirect to another page.

What I want to happen is this

 

When the CreatedUser Event is fired, I  want a Modal Popup to show up with a message Processing your registration.

once the registration code is processed it will close and the users get redirected.

 

On my ASPX I have the Modal PopUp and a Panel.

In the code behind in the handler I put ModalPop.show()

 

but this does not work.

 

thanks for any suggestions

 

 


InfoPath Workflow Task Form "Loading" event handler only being called after App Pool recycled.

  

I have a Workflow that is using an InfoPath task form.  In the "FormEvents_Loading" method event handler I have some code that needs to run each time the form is opened.   I recycle the App Pool and open the form the code runs perfectly, but if I close and try to re-open the form the code is not run at all.  I can then recycle the App Pool again and on the next load the code executes just fine.   The code that is supposed to be run is a very simple statement to set a field value, so I don't think it is interfering.

Does anyone know what this might be?

Thanks,
--Aaron


Event Handler Credentials

  

I made EH that checks out document when OOB Approval WF is finished successfully.

I want doc to be checked out by WF Initiator, but by default it is made by System Account.

How can i change Event Handler Account ?


Pre_Init event handler problem

  

Hi all my friends

   I have to masterpages for my home page.

1. The first is for the annonymous users which has the login controls. its name is General_Anonymous.master.

2. The second one is for the logged in users which has a logout button and it hasn't the login controls in it. its name is General_LoggedIn.master.


in my default.aspx page I wrote the following code

protected void Page_PreInit(object sender, EventArgs e)
    {
       
            if (Session["SupId"] == null && Session["CustomerId"] == null)
            {
                this.MasterPageFile = "~/Masters/General_Anonymous.master";
            }
            else
            {
                this.MasterPageFile = "~/Masters/General_LoggedIn.master";
      &nbs

Event Handler & AD

  
My event handler is working fine until i add AD part. After this string it stops firing at all: DirectoryEntry dom = new DirectoryEntry(); I mean it compiles, deploys and doesnt react to anything ( Why ? PS VS2010, SP2010  

how to get values of list item being entered in ItemAdding event handler?

  
Hi,          i am trying to get the values being entered in a listitem in the ItemAdding eventhandler as follows, but it doesnt work. public override void ItemAdding(SPItemEventProperties properties)         {             base.ItemAdding(properties);             SPSite CurrentSite = new SPSite("http://mm-moss/np/");             SPWeb CurrentWeb = properties.OpenWeb();             SPList CurrentList = CurrentWeb.Lists[properties.ListId];             string vehicleNo = CurrentList.Items[CurrentList.Items.Count - 1]["Vehicle No"].ToString();             string  name=CurrentList.Items[CurrentList.Items.Count-1]["Name"].ToString(); } when i debug i cant get hold of the VehicleNo value. canyone help me in getting the values of the list item being entered? Thank you all.

Create a meeting instance with an event handler

  
Hi, i want to know if its posible to insert a new meeting instance in a meeting workspace automatically when you add a new event in a calendar.   i try to pass automatically the option of the template selection.   its posible with the objetc model or web services?   thanks

Event handler that will take an e-mail sent to a doc library and save it as an .MSG file within the

  
Hi All, I have a requirement to create an event handler that will take an e-mail sent to a doc library and save it as an .MSG file within the library? Any help/inputs on getting this done is much appreciated.  Hanif

Sharepoint Event Handler not firing

  
I have written an event handler for an ItemAdded eventfor a document library. I am trying to read an excel file being uploaded and extract a value from it which I write to a list column for the item. I have this working properly on my development machine which is a Windows Server 2003 machine.However, on a production Windows Server 2008 machine, the event handler never fires. I am doing a simple write to a log file to test and see if it runs at all even if the Excel parsing does not work but I get no indication that it ran. The event handler is being registered with a feature that I am deploying. I have verified that the event handler is registered to the library by using the u2u Event Handler Explorer tool.Is there any way I can determine if my event handlers are even executing? How can I debug this?

ItemAdded Event Handler not firing

  
Hi, I have created an ItemAdded Event handler that is linked to a content type. This event handler does certain custom validations and then sends Email to users. I have referenced this event handler in XML file as well but somehow the event handler is not getting fired...Following is the code.   Code Snippet            this.DisableEventFiring();            using (SPSite site = new SPSite(properties.SiteId))            {                 using (SPWeb web = site.OpenWeb())                {                    base.ItemAdding(properties);                     SPList nList = web.Lists["NList"];                    SPList IList = web.Lists["IList"];                     foreach (SPListItem listItem in nList.Items)                    {                        if (listItem["Topic"].ToString() == properties.ListItem["Topic"].ToString())                        {                            SPUser alertUser = (SPUser)(properties.ListItem["SUser"]);                            SPUtility.SendEmail(web, false, true,alertUser.Email,"New item added", "A new item has been added");                         }                    }                    this.EnableEventFiring();                }            }       The XML file is: Code Snippet  <XmlDocuments>      <XmlDocument NamespaceURI="http://schemas.microsoft.com/

Event Handler not picking up error

  
I have a connection manager which uses a Variable as part of a ConnectionString. I have tried putting an Event handler on the package to capture any errors with the connection string. Unfortunately the event handler does not pick up any errors. I would like to add some screenshot but i am not sure how to do it on this forum.  Mr Shaw

Event handler to delete minor versions in document libraries

  
Hi Is there a way we can capture the deletion of minor versions in document libraries using any event handler. May not be using the delete all the minor versions but at least when we use the option to delete the selected minor version. I do not see the ItemUpdating and ItemUpdated getting fired in this case. Thanks wpwije  

Sequence - Container Event Handler - send one Email

  
I have a sequence container which contains three data flows. Have placed a event handler on the sequence container which emails me OnError. When   an error occurs i only want to get one email but I get eleven. This equals the number of tasks happening inside the sequence container. How can I get just one email? Mr Shaw

Create an Event Handler to catch calls to Create.aspx

  
Hi, I want to research creating an event handler/reciever to catch calls (mouse clicks) to Create.aspx to prevent users having the ability to create new content. I've noticed in VS2010 the templates for Event Recivers you do not get anything similar that I could use as a starting point (List Events, List Item Events etc) Any ideas how I can define a new type of event receiver?

System.Runtime.InteropServices.COMException with Event Handlers

  
hi,           i have written an ItemDeleting Event handler for a document library which holds images. the itemdeleting eventhandler works fine and displays the  errormessage on sharepoint error page when properties.cancel=true and properties.ErrorMessage="This Image is still being used in Announcements. Cannot Delete. ". this works fine when i delete from the doclibrary itself. when i delete the images in the document library from the ImageManger Tool of RadEditor it throws the com exception as follows instead of the sharepoint error page Server Error in '/' Application. -------------------------------------------------------------------------------- This Image is still being used in Announcements. Cannot Delete. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: This Image is still being used in Announcements. Cannot Delete. can anyone suggest, how to reslove this issue.? i have the screenshots,which would better explain but i dont know how to paste images into this forum? kindly let me know how to upload images to this forums also. thank you all

Execute Javascript from Sharepoint Event Handler

  
Hello, I want to execute a sample java script function from itemadding event of sharepoint event handler.  How can i achieve this? Please Help.   Thanks in Advance
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend