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 8331
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
| |