I've been trying to convert the following C# Dispose to VB .NET:
protected override void Dispose(bool disposing)
{
if (excelThread != null)
{
excelThread.Join();
}
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
Using the code below following, I get the error:
Method 'Dispose' has multiple definitions with identical signatures
What am I doing wrong?
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If Not (excelThread Is Nothing) Then
excelThread.Join()
End If
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
-- http://www.standards.com/; See Howard Kaikow's web site. 8 8417
Howard,
"Howard Kaikow" <ka****@standards.com> schrieb: I've been trying to convert the following C# Dispose to VB .NET:
protected override void Dispose(bool disposing)
{
if (excelThread != null)
{
excelThread.Join();
}
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
Using the code below following, I get the error:
Method 'Dispose' has multiple definitions with identical signatures
What am I doing wrong?
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
Where did you add the 'Dispose' method? Typically, forms, usercontrols,
etc. have an automatically generated 'Dispose' method which is part of the
"designer generated code" region. You may want to add the code to the
'Dispose' method of the designer generated code instead of adding your own
'Dispose' method.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
I thought about doing that, but the C## code did not do that, so I didn't
try.
I guess VB .NET could be doing things differently, I'll take a look.
-- http://www.standards.com/; See Howard Kaikow's web site.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eX**************@TK2MSFTNGP12.phx.gbl... Howard,
"Howard Kaikow" <ka****@standards.com> schrieb: I've been trying to convert the following C# Dispose to VB .NET:
protected override void Dispose(bool disposing)
{
if (excelThread != null)
{
excelThread.Join();
}
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
Using the code below following, I get the error:
Method 'Dispose' has multiple definitions with identical signatures
What am I doing wrong?
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
Where did you add the 'Dispose' method? Typically, forms, usercontrols, etc. have an automatically generated 'Dispose' method which is part of the "designer generated code" region. You may want to add the code to the 'Dispose' method of the designer generated code instead of adding your own 'Dispose' method.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Ayup, that was the problem.
I guess the original C# may also have had a Dispose in the Designer, but the
author may have removed the critter.
In any case anyone's interested, I took an extra dose of my masochist
medication, I am working thru Andrew Whitechapel's book MSFT .NET
Development for MSFT Office and converting the code to VB .NET. Al the
book's code is C#, other than, as I recall, 2 examples/
A very painful exercise.
But I'm learning a lot.
-- http://www.standards.com/; See Howard Kaikow's web site.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eX**************@TK2MSFTNGP12.phx.gbl... Howard,
"Howard Kaikow" <ka****@standards.com> schrieb: I've been trying to convert the following C# Dispose to VB .NET:
protected override void Dispose(bool disposing)
{
if (excelThread != null)
{
excelThread.Join();
}
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
Using the code below following, I get the error:
Method 'Dispose' has multiple definitions with identical signatures
What am I doing wrong?
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
Where did you add the 'Dispose' method? Typically, forms, usercontrols, etc. have an automatically generated 'Dispose' method which is part of the "designer generated code" region. You may want to add the code to the 'Dispose' method of the designer generated code instead of adding your own 'Dispose' method.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
It appears that C# does not hide the Dispose in the Designer, instead the
dispose is generated outside the Designer.
VB .NET just does this the other way.
Seems like quite a needless difference between the two languages for code
generation.
-- http://www.standards.com/; See Howard Kaikow's web site.
"Howard Kaikow" <ka****@standards.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Ayup, that was the problem.
I guess the original C# may also have had a Dispose in the Designer, but
the author may have removed the critter.
In any case anyone's interested, I took an extra dose of my masochist medication, I am working thru Andrew Whitechapel's book MSFT .NET Development for MSFT Office and converting the code to VB .NET. Al the book's code is C#, other than, as I recall, 2 examples/
A very painful exercise. But I'm learning a lot.
-- http://www.standards.com/; See Howard Kaikow's web site. "Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message news:eX**************@TK2MSFTNGP12.phx.gbl... Howard,
"Howard Kaikow" <ka****@standards.com> schrieb: I've been trying to convert the following C# Dispose to VB .NET:
protected override void Dispose(bool disposing)
{
if (excelThread != null)
{
excelThread.Join();
}
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
Using the code below following, I get the error:
Method 'Dispose' has multiple definitions with identical signatures
What am I doing wrong?
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
Where did you add the 'Dispose' method? Typically, forms, usercontrols, etc. have an automatically generated 'Dispose' method which is part of
the "designer generated code" region. You may want to add the code to the 'Dispose' method of the designer generated code instead of adding your
own 'Dispose' method.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Howard,
"Howard Kaikow" <ka****@standards.com> schrieb: It appears that C# does not hide the Dispose in the Designer, instead the dispose is generated outside the Designer.
VB .NET just does this the other way.
Seems like quite a needless difference between the two languages for code generation.
ACK. I would prefer the way C# handles it in VB.NET too :-).
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Clear evidence of a lack of proper design/review/control processes within
MSFT.
-- http://www.standards.com/; See Howard Kaikow's web site.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:O8**************@TK2MSFTNGP14.phx.gbl... Howard,
"Howard Kaikow" <ka****@standards.com> schrieb: It appears that C# does not hide the Dispose in the Designer, instead
the dispose is generated outside the Designer.
VB .NET just does this the other way.
Seems like quite a needless difference between the two languages for
code generation.
ACK. I would prefer the way C# handles it in VB.NET too :-).
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Howard,
Bellow are the standard conponent disposes methods from VBNet and C#. I do
not see any difference. With the exception that it is in VBNet hidden in the
windows for designer code and in C# outside that.
I hope this helps?
Cor
\\\
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub _
Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
///
\\\
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
///
Thanx.
The problem was that the author of the C# code had removed the Dispose in
the DEsigner, so when I was converting the code to VB .NET, I missed that
there might be a Dispose in the Designer.
Oh well, we have Disposed this topic.
-- http://www.standards.com/; See Howard Kaikow's web site.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:OV**************@TK2MSFTNGP15.phx.gbl... Howard,
Bellow are the standard conponent disposes methods from VBNet and C#. I do not see any difference. With the exception that it is in VBNet hidden in
the windows for designer code and in C# outside that.
I hope this helps?
Cor
\\\ 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub _ Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub /// \\\ /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } ///
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: faktujaa |
last post by:
Hi All,
A small confusion. I have defined a connection class that has
System.Data.IDbConnection as a member variable and implements IDisposable
interface. I have implemented Dispose method to call...
|
by: RiteshDotNet |
last post by:
..net Frame work
1. Dispose Method what it does ?
A. who its call / when it calls ?
B. Is it fire automatically ?
c. When dispose method is call what it does ?
D. Release a Object from memory or...
|
by: Daniel Mori |
last post by:
If an object implements the IDisposable interface (regardless if its a
framework object or a user object), should I always dispose of that
object out of principle?
|
by: Maxim |
last post by:
Hi!
According to documenation, if we need to release some umanaged
resources manually, we need to implement IDisposable interface with
single Dispose method. I am just wondering, what will...
|
by: Billy |
last post by:
Hello...
I'm trying to make a database access class for an asp.net
application. When I run my application, the Garbage
Collecter doesn't seems to unload the memory attributed
to my...
|
by: Scott M. |
last post by:
In a typical class, do I need to indicate that it implements the IDisposable
interface and then create a Dispose method that implements the Dispose
required by the IDisposable interface or can I...
|
by: Teresa |
last post by:
1) If I do want to keep an object alive throughout the live of an
application, how can I ensure that the GC doesn't clean it up?
2a) How do I determine if an object is a managed or an unmanged...
|
by: Dennis |
last post by:
Ok, I'm trying to dispose of every object that I create that has a dispose
method based on advice from this newsgroup. However, I'm not sure how to
dispose of the following object that was created...
|
by: active |
last post by:
In the main program I check to see if a certain form has been disposed.
Does it make sense in that form's FormClosed event to do:
Me.Dispose to make sure it is disposed the next time I check.
Or...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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: 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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
| |