473,665 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# call event in DLL

Hi everyone,

I have a problem calling an event in a DLL from a C# code. The dll is
written in VB.NET and I don't have the source code for it so I can't
modify it. The DLL came with an aspx file and they work fine together,
but the problem arose when I tried to convert aspx ("Page") into ascx
("UserControl") . After changing the file name to ascx and declaration
at the top of the page common web controls that have calles to events
in the DLL cannot sees them even though I've imported the dll at the
top of the control in declaration.

----------------------- This works --------------------------
<%@ Page Language="C#" Codebehind="Tes tCode.aspx.vb"
Inherits="TestD ll.TestCode" %>
.....
<!-- code below can see the event -->
<asp:button id="cmdTest" onClick="event_ in_dll"></asp:button>
-------------------------------------------------------------------

----------------------- This DOESN'T work --------------------------
<%@ Control Language="C#" %>
<%@ Imports Namespace="Test Dll" %>
.....
<!-- code below can NOT see the event -->
<asp:button id="cmdTest" onClick="event_ in_dll"></asp:button>
-------------------------------------------------------------------

I've tried everything that came across but had no luck. I have to
convert it to a User Control.
Could anyone help me with this please?

Thanks in advance,
Chan

Aug 21 '06 #1
2 5261
Hi,
<!-- code below can see the event -->
<asp:button id="cmdTest" onClick="event_ in_dll"></asp:button>
What this means is that to call a method declared in the parent class of the
current page. If you go to the aspx file you will see in the top a @Page
directire it will especify the parent class. All the methods implemented in
the parent class are part of the new class that will be generated by
compiling the aspx.

Now if you convert it to a user control the page including the control will
have to derive from the same class.

Or a possible solution could be to have the parent class of the new page
(the one that will include the control) to derive from the class defined in
the dll instead of Page as it usually the case.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


-------------------------------------------------------------------

----------------------- This DOESN'T work --------------------------
<%@ Control Language="C#" %>
<%@ Imports Namespace="Test Dll" %>
....
<!-- code below can NOT see the event -->
<asp:button id="cmdTest" onClick="event_ in_dll"></asp:button>
-------------------------------------------------------------------

I've tried everything that came across but had no luck. I have to
convert it to a User Control.
Could anyone help me with this please?

Thanks in advance,
Chan

Aug 21 '06 #2
Hi Ignacio,
Or a possible solution could be to have the parent class of the new page
(the one that will include the control) to derive from the class defined in
the dll instead of Page as it usually the case.
I've created a new page which inherits the dll and embeded the user
control in that page, and it looks like working. I am sure because I am
getting an "object reference not set" error. I guess what I'm trying is
sort of working but having another trouble inside the DLL.

Thank you for your reply,
Chan

Aug 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4034
by: JoeK | last post by:
Hey all, I am automating a web page from Visual Foxpro. I can control all the textboxes, radio buttons, and command buttons using syntax such as: oIE.Document.Forms("searchform").Item(<name>).Value = <myvalue> But I cannot control a dropdown with an onchange event. I can set the dropdown's value and selectedIndex, but then calling the onChange() or Click() does not do anything. It only seems to fire the onchange if I
3
11873
by: David N | last post by:
Hi All, I just wonder if in C#, I can develop a user defined control that can call its parent function which is not yet developed. For example, how do I make my user control call a to-be-developed-function cmdOkay_Click() function as described below. 1. Create an user control that contains an OK button as below Public Class MyButton:System.Windows.Form.UserControl
2
3003
by: rawCoder | last post by:
Hi I am having this InvalidOperationException with message Cannot call Invoke or InvokeAsync on a control until the window handle has been created This is raised when i try to invoke a method with arguments I need to do this as the method is being called Asynchronously from elsewhere using delegate's BeginInvoke method. The form is well created/initialized yet the messages states otherwise.
13
9778
by: jac | last post by:
Hae, I have a windows form with a ComboBox an other things. On that combobox I have an eventhandler on de selectedindexchanged. But somewhere in my code want to do excecute the same code that is writen in the eventhandler. Is it posible to call that eventhandler from the code (not from a real selectedindexchanged on the form). So, I don't have to call that code twice.
4
4279
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage I know I need to call a function that will save data but I'm not sure exactly when to call this function. I've tried two ways and both seem to have 'gotcha's':
22
3183
by: Ricky W. Hunt | last post by:
First, the subject probably doesn't use the correct terms but I'm not sure what it's called in VB. I'm writing a media player app. The subroutine that handles the "open file" button contains an If statement to see if a file was already playing and if so executes some code to stop the previous file from playing among other things. There's also a "stop" button on the form that contains the exact same code. Obviously it would be easier if...
7
1956
by: Bonzo | last post by:
>From within a function, I want to pass a/some parameters to another function, AND all arguments, passed into this function. e.g. function firstFunction(){ //this function may have been passed, 0, 1, or n arguments... ... //call another function... var someCalculatedValue = 'someValue';
4
3214
by: Paul | last post by:
Hi, I've been struggling with this today, I'm developing a DotNet2.0 website in C# that needs to call a long running data query. Obviously this is a good candidate for an Asynchronous call, so the page can carry on rendering whilst the call is taking place and also returning the ASP.NET worker thread to service another page request (for scalability). I have developed a very basic asynchronous object (for testing, that reproduces the same...
3
7419
by: Ignacio Machin | last post by:
How can I call an event from another event: I want to call : DropDownList_SelectedIndexChanged in: Page_Load
8
36118
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query button on it. If the query returns multiple results, a new window is opened with a grid containing the results. When the user double clicks on the desired row in the grid, I want the first form to populate with the correct data. I don't know how...
0
8348
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8779
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1761
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.