C# - Event Parameter; "sender As Object", Or "sender As T"?

Feb 9, 2011

When I write public events for my business objects, I've adapted the habit of always passing the instance as "sender as Object", in addition to additional specific parameters. I just asked myself now why am I not specifying the class?

So for you with more experience; Do you ever pass the distinct class as sender in an event? And if so, what are your decision criteria for when this is ok/not ok?

View 8 Replies


ADVERTISEMENT

Getting The Type Of Sender In (ByVal Sender As Object)?

Aug 13, 2011

(me = an absolute beginner in WPF / VB2010) how to get the type of sender in (ByVal sender As Object)? Purpose: when two different Objects call the same subroutine, find out which one actually called it.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
sayHello(sender)
End Sub

[code]....

View 5 Replies

Determine What Type Of Object Is The Sender Of An Event?

Nov 25, 2011

Heres my sub:

Dim onThisTable as String ="Name"
Private Sub skill_mouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.MouseHover, button2.MouseHover, panel1.MouseHover, panel2.MouseHover, pbox1.MouseHover

[Code]....

Now I wish to give onThisTable a different value depending what the user pass over (panel or a pbox or a button) but I cant find what is the correct way to compare what type it is ...

Private Sub skill_mouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.MouseHover, button2.MouseHover, panel1.MouseHover, panel2.MouseHover, pbox1.MouseHover

[Code]....

View 1 Replies

Custom DataGridViewColumn - Error: 'Public Event ItemCheck(sender As Object, E As System.Windows.Forms.ItemCheckEventArgs)'

Jan 19, 2012

following code from c# to visual basic, and I'm coming up with the following error: 'Public Event ItemCheck(sender As Object, e As System.Windows.Forms.ItemCheckEventArgs)' as an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.

[Code]...

View 8 Replies

Console App Using Sender As Object And E As EventArgs?

Mar 30, 2012

I have the following code that allows my console app to go to the tray with an icon:

Sub Main()
Dim tray As New NotifyIcon()
tray.Icon = My.Resources.phoneIcon

[code].....

View 1 Replies

C# - Event Signature In .NET -- Using A Strong Typed 'Sender'?

Jun 25, 2009

I fully realize that what I am proposing does not follow the .NET guidelines, and, therefore, is probably a poor idea for this reason alone. However, I would like to consider this from two possible perspectives:

(1) Should I consider using this for my own development work, which is 100% for internal purposes.

(2) Is this a concept that the framework designers could consider changing or updating?

I am thinking about using an event signature that utilizes a strong typed 'sender', instead of typing it as 'object', which is the current .NET design pattern. That is, instead of using a standard event signature that looks like this:

[Code]...

View 11 Replies

VS 2008 Generic Event Determine Sender In Sub

Jul 8, 2009

Is it possible to have a sub that is triggered when any control of a specified type is clicked (or some other interaction), and then within the code of that sub, determine the sender and depending on the sender perform an action?For example, you create buttons dynamically, and assign them a name based on a counter that tells the number of buttons on the form. Now you click on a button, but there was no code written for 'button123.mouseclick' specifically. Instead, you get the name of the sender (button123) and you do something specific to that button.[code]

View 5 Replies

Private Sub Txtbval_KeyPress(ByVal Sender As Object?

Jul 20, 2009

my code as follows

[code]...

result i get here is =0.7937005259841017310542661502

where as windows calculator figure is 0.79370052598409973737585281963615

View 16 Replies

C# To VB: Class.Event += (sender, Args) => FunctionName(params)?

Apr 6, 2011

I'm trying to convert the C# code from this webpage to VB.Everything seems to have converted pretty much fine using an online converter tool, but then I reach the following line:

fadeOutAnimation.Completed += (sender, args) => OnFadeOutAnimationCompleted(d, hostGrid, grid);

The fadeOutAnimation.Completed event produces an event with the signature (sender, args), and d, hostGrid and grid are variables local to the function containing this mysterious event handler assignment.

I think I can see that the instruction on this C# line is telling the code to execute the OnFadeOutAnimationCompleted function, using d, hostgrid and grid as parameters, when fadeoutAnimation.Completed occurs, but I have no idea what to even search for in order to replicate this behaviour in VB.net.

View 5 Replies

Determining List Index Of Child Event Sender?

Feb 23, 2009

I have a list of objects, each with several events. I can add an eventhandler to each object, so I can catch each item's events. But I would also like to know the sender's index in the list (ie, was this object the 3rd, 5th, etc, item in the list?) I'm guessing the object doesn't "know" its position.I could give each object an index number property when it is created and added to the list, so that information could be passed. However, I would have to reindex every item everytime I use remove, insert, etc, methods.

View 4 Replies

Private Sub Btnedit_Click(ByVal Sender As System.Object?

Feb 15, 2012

Private Sub btnedit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnedit.Click

[Code]...

View 2 Replies

Private Sub Button1_Click(ByVal Sender As System.Object?

Jan 19, 2009

I have a little VB 2005 Express app that acts as a gui for an application that normally runs in a cli (cmd-like) window, as follows: Code:Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Server_Exe As String = "C:Documents and SettingsColinDesktopin 7302OpenSim.Grid.UserServer.exe"

[Code]...

1. The cmd window normally shows various status messages in colour, whereas the RichTextBox shows all messages in Black (on a white background). How can I get the RichTextBox to show the messages in the same colours that the cmd window displays?

2. As the RichTextBox fills with data, filling the box, and beyond, and the scrollbar starts to shrink, I notice that the data at the top of the RichTextBox stays there, and you would have to scroll down to see the last status message, whereas I would like it to do the reverse, i.e the last status message is at the bottom of the visible RichTextBox, and if I wanted to see the earlier messages I would have to scroll up. How can this be achieved?

View 6 Replies

Private Sub FontToolStripMenuItem_Click(ByVal Sender As System.Object ?

Dec 26, 2010

Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click Or Button1.Click

Is it possible to make a or?

View 1 Replies

Private Sub Form1_Shown(ByVal Sender As System.Object?

Feb 25, 2011

Private Sub Form1_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown

View 1 Replies

Private Sub XExitButton_Click(ByVal Sender As System.Object?

Mar 19, 2010

it just gives me zero for my anwser.Can someone please make corrections?Public Class Form1 Private Sub xExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xExitButton.Click

[Code]...

View 1 Replies

Sender As Object IntelliSense Only Lists 5 Methods And No Properties

Feb 3, 2012

When you type sender. IntelliSense lists 5 methods and yet if you type sender.Left or sender.top these will work. Why don't these properties show up as available for use via IntelliSense.

View 2 Replies

Raise Activated(Sender, EventArgs) Event Of An Active MDI Project?

Dec 4, 2009

I have a MDi project , I want to raise the activated(Sender, eventArgs) event of activeMdi Form

View 5 Replies

Communications :: Private Sub Form1_Load(ByVal Sender As System.Object?

Jul 13, 2010

Why isn't this seemingly simple piece of code working?

Code: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each sp As String In My.Computer.Ports.SerialPortNames
ListBox1.Items.Add(sp)
Next
End Sub

View 9 Replies

Make "sender" Parameter?

Mar 30, 2011

Using the following example, the author is explaining the "sender" parameter...

Private sub picText_MouseDown(ByVal sender as Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles picText.MouseDown

[code]....

View 3 Replies

IDE :: Private Sub TextBox1_TextChanged(ByVal Sender As System.Object, ByVal E As System.EventArgs) Handles TextBox1.TextChanged

Jun 10, 2011

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

Textbox1 how the text box by real-time data monitoring?

View 1 Replies

Execute Button - "sender As System.Object - E As System.EventArgs"

Apr 30, 2009

How do I execute "Button1_Click" when click "Button2" like "Button1.Click(######)"? When I try to write Button1.Click() then that keep asking me "sender As System.Object,e As System.EventArgs". What value that I have to have "sender As System.Object, e As System.EventArgs"

[Code]...

View 2 Replies

Private Sub Cv7import_Load(ByVal Sender As System.Object, ByVal E As System.EventArgs)

Jan 5, 2012

I'm making this program that opens the same forder in every pc but it identifies the pc name to do it.

Public Class cv7import Private Sub cv7import_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[Code]...

but I want it to do it with the pc's name and I'm not sure how the environment.systemdirectory works, or even if it's the right one to use. Is it the right thing to use or is there a better solution.

View 12 Replies

Design An SMS SENDER Using VB .NET?

Jun 6, 2009

I'm new to VB .NET. I would like to design a sms sender application which could use internet connectivity to send messages to any mobile number. Should I use any messaging APIs? Where should I start?

View 1 Replies

Get Panel Name That Sender Is In

Oct 27, 2009

Is there a fast way to get the name of a panel that the "sender" is in without looping through controls & comparing? I haven't worked with panels much.

View 3 Replies

How To Get The Sender Control In A Sub

Nov 18, 2011

Like the title. Any way to let the "sub" know which "control" call it? Like when the "button1" pressed, "button1" call a sub named "buttondown". How can the "buttondown" know which button call it?

View 14 Replies

Set The Envelope Of A Sender

Nov 21, 2011

We have a server that I use to blast out emails. The reverse IP for it is intellicomweb.com. One of the programs my client uses to send mail uses the from address and it's a gmail address. I'm getting bounced from this one company and they have told me they are bouncing it because my sender enveloper is not a intellicomweb.com address. Here's what I have for sending the mail code. What do I need to do to set the sender enveloper?

[Code]...

View 1 Replies

Better Method For Selecting Sender Of A Sub

Nov 12, 2009

I want to know if there's a better method for selecting the sender of a sub like this .[code]

View 8 Replies

Email Receiver And Sender?

Jan 9, 2011

Is there a way to where i can send emails, but to the specific email client or receiver i make?

View 2 Replies

Events And Sender Types

Feb 28, 2009

How do I check and see if a sender is a specific type in this case a picturebox.I created my own class called sprite, and then a sub class called alien for use with this specific game I'm creating. In it I created an event to handle whenever the picturebox moves to see if it intersects with another picturebox with a specific..[code]

View 10 Replies

Getting 1 Error On Mail Sender?

Oct 15, 2009

im after creating a msn mail senderbut when i debug it and try sending a mail i get 1 error. heres the code im using :

[Code]...

View 13 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved