Questions tagged [raiseevent]

76 questions
50
votes
3 answers

How do I raise an event in a usercontrol and catch it in mainpage?

I have a UserControl, and I need to notify the parent page that a button in the UserControl was clicked. How do I raise an event in the UserControl and catch it on the Main page? I tried using static, and many suggested me to go for events.
user677607
19
votes
5 answers

How do I fire an event in VB.NET code?

I have a form that has a start button (to allow users to run the processes over and over if they wish), and I want to send a btnStart.Click event when the form loads, so that the processes start automatically. I have the following function for the…
David Gard
  • 11,225
  • 36
  • 115
  • 227
12
votes
2 answers

Convert c# to vb.net 'RaiseEvent' statement to raise an event to use Gzip

I have convert class from c# to vb.net .. My point that I want to compress asp.net page to reduce the page size ,, Problem is after i convert to vb.net ,i have this error Description: An error occurred during the compilation of a resource required…
Mohammed Ali
  • 696
  • 3
  • 9
  • 22
10
votes
4 answers

c# event handler is called multiple times when event is raised once

Below is my code, first is where I raise the event and second section is where I consume it in another class. It seems pretty straight forward, but the logs are showing that even though the event is raised once, the event is firing 20+ times on the…
Jason Smith
  • 373
  • 2
  • 6
  • 20
8
votes
4 answers

Firing MouseLeftButtonDown event programmatically

I'm trying to manually fire a MouseLeftButtonDown event on a WPF control programmatically, as I am using the Microsoft Surface SDK, which does not fire MouseLeftButtonDown events, but ContactDown events. Basically I'm trying to push the…
RajenK
  • 1,403
  • 3
  • 15
  • 25
8
votes
2 answers

How to check for subscribers before raising an event in VB.NET

In C#, you do something like this: if (Changed != null) Changed(this, EventArgs.Empty); But what do you do in VB.NET? There is RaiseEvent, but is RaiseEvent Changed(Me, EventArgs.Empty) actually checking that something has subscribed to the…
Sacha K
  • 602
  • 6
  • 22
3
votes
5 answers

How to raise a textbox TextChangedEvent programmatically

I'm using .net 4.5, in a WPF project. I would like to raise a TextBox TextChangedEvent. This is what I have done so: tb.RaiseEvent(new RoutedEventArgs(TextBox.TextChangedEvent)); I've done the same sort of RaiseEvent on a Button.ClickEvent before,…
Hank
  • 2,456
  • 3
  • 35
  • 83
3
votes
2 answers

in vb.net how do I raise a click event for a label

I have a several labels all coded as such: Public assessment_menu_button As New Label Public current_label_clicked As New Label AddHandler assessment_menu_button.Click, AddressOf click_assessment_menu_button Private Sub…
John
  • 1,310
  • 3
  • 32
  • 58
3
votes
3 answers

Raising Custom Class Events In Windows Service C#

I did write a windows service that can connect to a network device using a dll. so everything works fine, but The event handler does not work in win service! here is my code : My Custom Class Code : using System; using…
Younes Jafari
  • 251
  • 1
  • 5
  • 17
2
votes
0 answers

How to raise an event from vb6 Form to a usercontrol?

I am trying to RaiseEvent from a button, this button is located in a Form. Then the idea is to raise the final even to the usercontrol. I have tried the next code: Form1 Dim Sec As Integer Public Event TestEvent() Private Sub…
2
votes
1 answer

Raise event in C# and catch in C++ MFC

I come from a .net background and I am fairly new to developing in C++. I am well used to events in C# and raising events when something meaningful happens. What I'm not sure about it how to raise "an event" in C++ just when an event raised in…
2
votes
1 answer

SSIS Logging - Capture Variables?

I'm trying to capture the values of about 15 variables within my sysssislog when my package executes. I have set all the variables to true for "Raise event when variable value changes" and I understand I have to put some sort of object/code into…
Philip
  • 2,460
  • 4
  • 27
  • 52
2
votes
2 answers

DragDrop event not raised

This is kind of a stupid question... I'm trying to drag and drop a picturebox onto a panel. I followed some exemples, but it doesn't work. The DragDrop event of the panel is never raised. I searched thi site for a solution andfound two topics over a…
Amaranth
  • 2,433
  • 6
  • 36
  • 58
2
votes
2 answers

After conversion to VB, 'is an event and cannot be called directly.'

The code below is part of project to save exceptions globally. I have converted this from C# to VB with both SharpDevelop and with Telerik's Code Converter, and I get identical results. Searching through Stackoverflow, I found this question: "'Why…
DanW52
  • 67
  • 7
2
votes
1 answer

What is the difference between these possibilities to raise an event in C#?

Imagine an event private event EventHandler SampleEvent; which should be raised. I know 3 ways to do this, but I don't get the difference between two of them which are SampleEvent(this, EventArgs.Empty); and SampleEvent.Invoke(this,…
Rob
  • 919
  • 7
  • 16
1
2 3 4 5 6