473,387 Members | 3,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

raise an event error when converting c# code to vb.net

Hi, I have converted C# code to vb.net using the online converter tools. One error messages I can't seem to figure out. Any ideas or help is appreciated.

Expand|Select|Wrap|Line Numbers
  1.   Public Sub New()
  2.         InitializeComponent()
  3.  
  4.         Me.Flip1Half.Completed += New EventHandler(AddressOf Flip1Half_Completed)
  5.     End Sub
  6.  
  7.  
error mesage:
Error 8 'Public Event Completed(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.

thank's for any help .

Alan
Jan 10 '11 #1

✓ answered by David Gluth

There really isn’t enough information here to figure out what is supposed to be happening.

VB event basics:

Declare an event: - [from your error message it looks like this is in there somewhere
Expand|Select|Wrap|Line Numbers
  1.  Public Event Complete(byVal sender as Object,ByVal e as System.EventArgs)
Raise an event: - [I think this is probably somewhere in your code as well]
Expand|Select|Wrap|Line Numbers
  1.  RaiseEvent Complete(me,args)
The line is that is causing you a problem is an attempt to dynamically assign a sub routine to the event.

This is where the lack of code become a problem for us to guess at. Typically the code would look like this:

Expand|Select|Wrap|Line Numbers
  1. Dim myObj as new Flip1Half()
  2.  
  3. addHandler myObj.Completed, AddressOf Procedure_to_run_when_event_occurs
  4.  
  5. sub Procedure_to_run_when_event_occurs(sender as object,e as system.EventArgs)
  6.     Do something
  7. End sub
  8.  

2 3434
There really isn’t enough information here to figure out what is supposed to be happening.

VB event basics:

Declare an event: - [from your error message it looks like this is in there somewhere
Expand|Select|Wrap|Line Numbers
  1.  Public Event Complete(byVal sender as Object,ByVal e as System.EventArgs)
Raise an event: - [I think this is probably somewhere in your code as well]
Expand|Select|Wrap|Line Numbers
  1.  RaiseEvent Complete(me,args)
The line is that is causing you a problem is an attempt to dynamically assign a sub routine to the event.

This is where the lack of code become a problem for us to guess at. Typically the code would look like this:

Expand|Select|Wrap|Line Numbers
  1. Dim myObj as new Flip1Half()
  2.  
  3. addHandler myObj.Completed, AddressOf Procedure_to_run_when_event_occurs
  4.  
  5. sub Procedure_to_run_when_event_occurs(sender as object,e as system.EventArgs)
  6.     Do something
  7. End sub
  8.  
Jan 13 '11 #2
Hello David,

Yes you are correct, actualy i got it to run a couple days ago with the the following;

Public Sub New()
InitializeComponent()

AddHandler Me.Flip1Half.Completed, New EventHandler(AddressOf Flip1Half_Completed)

End Sub

thank's for replying,

Alan
Jan 14 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: mdawoodk | last post by:
i am getting error "input string was not in correct format" when converting a string decimal into integer value. code is like this: string strVal = ""; int nVal = 0; strVal = "14.9"; nVal...
1
by: Kalpana | last post by:
I have converted my C#.Net project code from .Net 1.1 to .Net 2.0. After resolving the build errors iam unable to open the application due to Utilitylibrary Rebar class --WndProc() method is...
2
by: psbasha | last post by:
Hi , I am getting the following error in ActiveState ActivePython2.4,when executing the UI which I worked in Python2.4.2 downloaded from www.Python.org ...
2
by: pillappa | last post by:
Hi, I am hitting this error consistently and don't know why it's happening. I would like to define all exceptions for my project in one file and use them across the project. Here's a sample - ...
1
by: cmdolcet69 | last post by:
In the below code exact line If _graphicScreenShots(intloop) = "Summary" Then....... I get an error message Overload resolution failed because no Public '=' can be called with these arguments:...
10
by: Karl Rhodes | last post by:
Hi all, I'm in the middle of converting some C# code to VB and I'm almost done, but this last little bit is confusing me. I'm trying to convert the following C# code... public event...
1
by: Anandshr | last post by:
I have a database created in Ms Access 95 file format. now i want to convert it into Ms Access 2000,2002 or 2007 file format. I got the error when converting that database. I've already tried to...
1
Bob Ross
by: Bob Ross | last post by:
I have a vb.net 2.0 website and I am trying to change it to a web application. I have followed these instructions here - http://webproject.scottgu.com/VisualBasic/Migration2/Migration2.aspx up to...
2
by: clintonb | last post by:
Victor said: The double value that I'm trying to convert to GCSMoney (which is implemented as cents) was produced by multiplying a dollar amount by an interest rate to get interest. double...
4
by: simulationguy | last post by:
I inherited an Access 2003 database runs fine in 2003 but in 2007 I get an error on updating a form. Record Not available on the last statement !ItemNumber.SetFocus Does anyone know why...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.