473,396 Members | 2,010 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,396 software developers and data experts.

Abort a class in NEW() ?

I'm using VB in ASP.NET, i would like to abort a class.
Best would be during the new member.
The result should be: Nothing

Is this possible?
Nov 29 '05 #1
9 1118
What do you mean with 'aborting' a class?

If you mean setting an instance of a class to Nothing in the constructor of
that class... AFAIK that can't be done.

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dm**********@azure.qinip.net...
I'm using VB in ASP.NET, i would like to abort a class.
Best would be during the new member.
The result should be: Nothing

Is this possible?

Nov 29 '05 #2
No. I'm almost positive new is always guaranteed to return an instance, or
throw an exception, no alternatives.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dm**********@azure.qinip.net...
I'm using VB in ASP.NET, i would like to abort a class.
Best would be during the new member.
The result should be: Nothing

Is this possible?

Nov 29 '05 #3
Oh, and by the way, it's a good thing that it can't be done, else you'd have
to check for null each time you used new...ugh..ugly code.

The solution, by the way, is to your a Factory. make the constructor
private, and then create a static (shared in vb.net) method:

public class product
private sub new
end sub

public shared function CreateInstance() as Product
if (whatever) then
return nothing
end if
return new Product()
end function
end class
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dm**********@azure.qinip.net...
I'm using VB in ASP.NET, i would like to abort a class.
Best would be during the new member.
The result should be: Nothing

Is this possible?

Nov 29 '05 #4
Maybe you are right.

Similar:
A com interface should be possible to be recreated if it could be created
the first time.
(A short of guarantee/guideline which should be followed)
I guess it's no different for these kind of objects qua strategy.
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schreef in bericht news:uu**************@TK2MSFTNGP12.phx.gbl...
Oh, and by the way, it's a good thing that it can't be done, else you'd
have to check for null each time you used new...ugh..ugly code.

The solution, by the way, is to your a Factory. make the constructor
private, and then create a static (shared in vb.net) method:

public class product
private sub new
end sub

public shared function CreateInstance() as Product
if (whatever) then
return nothing
end if
return new Product()
end function
end class
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dm**********@azure.qinip.net...
I'm using VB in ASP.NET, i would like to abort a class.
Best would be during the new member.
The result should be: Nothing

Is this possible?


Nov 29 '05 #5
Which trimester?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dm**********@azure.qinip.net...
I'm using VB in ASP.NET, i would like to abort a class.
Best would be during the new member.
The result should be: Nothing

Is this possible?

Nov 29 '05 #6
Huh?
Elaborate..
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> schreef in bericht
news:Ol**************@TK2MSFTNGP14.phx.gbl...
Which trimester?

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dm**********@azure.qinip.net...
I'm using VB in ASP.NET, i would like to abort a class.
Best would be during the new member.
The result should be: Nothing

Is this possible?


Nov 29 '05 #7
Hmm, problems with my sentences?
:)

I'm from Holland.
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> schreef in bericht
news:dm**********@azure.qinip.net...
Huh?
Elaborate..
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> schreef in bericht
news:Ol**************@TK2MSFTNGP14.phx.gbl...
Which trimester?

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dm**********@azure.qinip.net...
I'm using VB in ASP.NET, i would like to abort a class.
Best would be during the new member.
The result should be: Nothing

Is this possible?



Nov 29 '05 #8
Sorry, Edwin. It was an abortion joke. Tasteless, and probably meaningless
in Holland. Pay no attention to the man behind the curtain.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dm**********@azure.qinip.net...
Hmm, problems with my sentences?
:)

I'm from Holland.
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> schreef in bericht
news:dm**********@azure.qinip.net...
Huh?
Elaborate..
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> schreef in bericht
news:Ol**************@TK2MSFTNGP14.phx.gbl...
Which trimester?

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dm**********@azure.qinip.net...
I'm using VB in ASP.NET, i would like to abort a class.
Best would be during the new member.
The result should be: Nothing

Is this possible?



Nov 29 '05 #9
I didn' tget it ,and it _was_ bad when you cleared it up...

:)

Karl

--

MY ASP.Net tutorials
http://www.openmymind.net/

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OI**************@TK2MSFTNGP12.phx.gbl...
Sorry, Edwin. It was an abortion joke. Tasteless, and probably meaningless
in Holland. Pay no attention to the man behind the curtain.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dm**********@azure.qinip.net...
Hmm, problems with my sentences?
:)

I'm from Holland.
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> schreef in bericht
news:dm**********@azure.qinip.net...
Huh?
Elaborate..
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> schreef in bericht
news:Ol**************@TK2MSFTNGP14.phx.gbl...
Which trimester?

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dm**********@azure.qinip.net...
> I'm using VB in ASP.NET, i would like to abort a class.
> Best would be during the new member.
> The result should be: Nothing
>
> Is this possible?
>
>



Nov 30 '05 #10

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

Similar topics

14
by: Daisy | last post by:
From this page: http://www.c-sharpcorner.com/2/mt_beginner1.asp Thread class's Abort method is called to kill a thread permanently. Make sure you call IsAlive before Abort. if (...
6
by: LP | last post by:
Hi, I am starting a new thread from the main UI thread. If users clicks cancel button, the thread is aborted: workerThread.Abort(); ThreadAbort Exception is handeled in the worker thread: ...
18
by: Urs Vogel | last post by:
Hi I wrote an application server (a remoting sinlgeton), where processes must be stopped in very rare cases, done thru a Thread.Abort(). Occasionally, and only after a Thread.Abort(), this...
0
by: nidhig | last post by:
Hi I am trying to implement the Abort functionality in progress bar control. Scenario is like this. I have a web application which performs a very long computation process. This computation...
5
by: Bob Altman | last post by:
Hi all, I have a WinForms app that has no main window (just a module with a Sub Main). My Main routine calls a subroutine that wants to politely abort the application rather than return to its...
5
by: Alan T | last post by:
I will do several things in my thread: Copy a file to a location Update database record Read the file content Write the content to a log file If I call Thread.Abort(), it may be possible to...
6
by: Marvin Barley | last post by:
I have a class that throws exceptions in new initializer, and a static array of objects of this type. When something is wrong in initialization, CGI program crashes miserably. Debugging shows...
5
by: andrew | last post by:
Hi, I have the following issue with the Thread.Abort(): The main thread creates a worker thread which waits on a process termination. void ThreadProc() { Process proc =...
1
by: Nimral | last post by:
Hi folks, is there a smart way to develop efficiently that helps me in the following situation: a sub calls a subsub, which calls a subsubsub, and so on. Within a subsubsub an error occurs...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
marktang
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,...
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
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...
0
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...

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.