|
Hi,
Currently I'm working on a Smart Device project in VB.NET (in Visual Studio 2008) and I found a project on the net in C# which fits to my needs so I added to my solution as a class library.
So right now I have a solution with a VB project and a C# project (class library).
In the C# I have a part like this:
namespace Something
{
public class SomeList : SomeListControl
{
public event EventHandler SiteReached;
public event EventHandler SiteOpened;
public event EventHandler<ListEventArgs> ListOpened;
...
This namespace is included in my VB project as a Reference.
Public Class MainClass
Private SomeControl As SomeList
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
'In the C# project the following code was implemented:
'SomeControl.SiteReached += (s, ea) => miBack.Enabled = false;
'SomeControl.SiteOpened += (s, ea) => miBack.Enabled = true;
'SomeControl.ListOpened += new EventHandler<ListEventArgs>(SomeControl_ListOpened);
'What can I do to inherit those Eventhandlers?
...
Thank you in advance for your kind help.
|
|
|
|
|
Do you have a question? Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Yes I do.
Actually the question is in the last code:
What can I do to inherit those Eventhandlers?
|
|
|
|
|
Sorry I missed the question.
The declaration of the SomeControl object should be :-
Private WithEvents SomeControl As SomeList Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
I'm sorry I wasn't clear what my question was.
And thank you very much for your quick replies.
I did the fix you suggested but still the error is there: 'SomeControl' is not an event of 'MyProject.Main' for
RaiseEvent SomeControl.SiteReached
Edit:
I also added to the
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click SomeControl.SiteReached
No luck.modified on Tuesday, February 16, 2010 4:50 AM
|
|
|
|
|
You need to handle the events of SomeControl within your MainClass then raise another event from the handle that is specific to your MainClass for example
Private Sub SomeControl_SiteReached() Handles SomeControl.SiteReached
'Additional validation goes here, if required
RaiseEvent SiteReached()
End Sub
Public Event SiteReached() Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Thank you, that builds.
Finally: Can you point me to the right direction what this does/means?
SomeControl.SiteReached += (s, ea) => miBack.Enabled = false;
SomeControl.SiteOpened += (s, ea) => miBack.Enabled = true;
SomeControl.ListOpened += new EventHandler(SomeControl_ListOpened);
Should I ask in C# forum?
|
|
|
|
|
The last one is easy
SomeControl.ListOpened += new EventHandler(SomeControl_ListOpened);
converts to
AddHandler SomeControl.ListOpened, Addressof SomeControl_ListOpened
The other two are rather tricky. They use lambda functions which VB doesn't really support. Essentially
SomeControl.SiteReached += (s, ea) => miBack.Enabled = false;
Says, "Add a new handler for SiteReached that takes two parameters (s and ea). This function will set miBack.Enabled = False ."
Making the Sub in VB is rather easy
Sub SomeControl_SiteReached(s as Sender, ea as System.EventArgs)
The hard part is duplicating the middle. If miBack is global or accessible from SomeControl_SiteReached then you are fine. If miBack is local to ManuItem1_Click , then you have a problem. You will have to find some way to change the Enabled state for miBack .
|
|
|
|
|
Hello,
I want to display menu list on specified hot key such as 'ALT + S'.But i m unable to get key combination.as i press Alt the keydown event is fire it does not accept combination .Please help .
'Keypreview = true'.
|
|
|
|
|
If its Menu then in menu you can specify the Short key by just setting the Values , you dont need to do anything Best Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Just wondering if the keypreview is causing the problem. I never use it but unless it is handled correctly it could zap the key combination as far as the menu is concerned. Just set Alt+S on your menu hotkeys
|
|
|
|
|
I like to calculate the total to a field [trn_qty] from Dtb1 [Datatable]. For that any ideas...?
My Query is
Dim Numbers = Dtb1.AsEnumerable()
Dim SvQy = (From n In Numbers Select n.Field(Of Decimal)("trn_qty")).Sum()
But Iam not getting any O/P. Also I don't know whether its correct or not... Any better ideas?
Thanks
|
|
|
|
|
I haven't tried your syntax but if you have null values, then you need to add a where clause to filter those out. 'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
dear friends, i need a vb.net project of "information visualizing system".in this project,generally we enter data inform of cost which is spend to carry out the project or any organization will display in form of pie chart or histo diagram.
|
|
|
|
|
Without wishing to put too fine a point on it then I suggest that you write one.modified on Monday, February 15, 2010 8:26 AM
|
|
|
|
|
TheComputerMan wrote: put too fine a point on it
I read your message and when i read the text above, instantly thought of 'They Might be Giants - Birdhouse in your Soul' http://www.youtube.com/watch?v=NAbZzdalZh4[^]
Strange how song lyrics just pop out of nowhere!
|
|
|
|
|
In which case, try specifying the system, then code it, test it and document it. Come back with specific problems, complete with your code Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks in advance
Is there any way to send email without using SMTP protocol Best Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
modified on Tuesday, February 16, 2010 5:41 AM
|
|
|
|
|
Not that I am aware of, but you could try a Google search to see if anyone has solved the problem. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Yes i had tried on google and other search engines etc but all most of them use SMTP Best Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
I don't know whether it's appropriate under your current restrictions, but you might be interested in this[^] CodeProject article on MAPI I are Troll
|
|
|
|
|
You could write out your email by hand and pop it in an envelope and send it using snail mail! Alternatively, you could fax it to someone.
|
|
|
|
|
Best Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
What are you trying to achieve?
You could use an IMAP client...........
|
|
|
|
|
I thought IMAP was for receiving mail, not sending? I may be wrong, I am not an expert but I thought you had to use SMTP to send mail.
|
|
|
|