|
AndyInUK wrote: How can i call a private void abc(def ghi) method from a page load.
Here def is a abstract class.
def being an astract class isn't going to make any difference that I can see. ghi is a reference to the base class def , ghi will naturally have to be a instance of a class derived from def that isn't abstract.
The issue is where is this private method located. If it is in the same class as the Page_Load then that's fine. If it is anywhere else then it isn't fine.
|
|
|
|
|
yes it is in the same class as Page_Load. it is user control code basically.
but i am not getting the right syntax ?
i have tried calling abc(ghi). This gives me runtime error. So is something wrong with the method or i am calling it wrongly in page load
|
|
|
|
|
AndyInUK wrote: but i am not getting the right syntax ?
Something like this?
def ghi = new jkl();
abc(ghi);
If that isn't want you meant could you explain a bit more.
|
|
|
|
|
That was odd... Your message just disappeared. Here is my response to it.
AndyInUK wrote: So how to create instance of this abstract class ?
You cannot make an instance of an abstract class. Marking a class as an abstract is telling the compiler that you don't want anyone creating an instance of it. You must derive from an abstract class and make an instance of that.
AndyInUK wrote: And how did the jkl derived from abc?
public abstract class abc
{
}
public class jkl : abc
{
}
|
|
|
|
|
AndyInUK wrote: yes it is in the same class as Page_Load. it is user control code basically.
Is it part of the page, or part of that user-control? If it's private to the user-control, you won't be able to call it from outside that user-control.
I are troll
|
|
|
|
|
Weird... Another message disappears just as I'm replying to it...
AndyInUK wrote: There are various methods derived in abstract class
That doesn't make any sense.
You derive a class. You override methods. Or you make methods virtual (available for overriding) or abstract (mandatory for overriding)
AndyInUK wrote: I am unable to find such derived class.
If I knew what you were talking about rather than naming things after sequential groups of letters it might make more sense.
|
|
|
|
|
Hi,
I'm trying to read a file which is present in remote PC (basically i've created a logical drive in my local system and mapped it) it works well during debug mode but it doesnt work in the release mode (when i install the project).
Do i need to set any permissions? It is C# Windows Application.
Thanks
|
|
|
|
|
satsumatable wrote: it doesnt work in the release mode (when i install the project).
How, exactly, does it not work? Does it produce an error? If so what? If not how can you tell it isn't working?
|
|
|
|
|
It throws an error as like below
It is saying part of the file path is not found.
|
|
|
|
|
probably you call like "myfile.exe". That means, if you change the directory, then the file is not there anymore.
Try to call using fullname, like "c:\mydir\myfile.exe".
|
|
|
|
|
use try catch, show the exception message, then you can see what's wrong with your application.
|
|
|
|
|
file path is exactly going like "c:\mydir\myfile.exe"
|
|
|
|
|
try to show your path+file in a messagebox, just find it, whether the file exists or not.
|
|
|
|
|
You need to put a '@' before the string to handle the back slashes correctly:
@"c:\mydir\myfile.exe"
|
|
|
|
|
Hi,
I got an error "A security exception was not handled in your code" when i try to open a page using server.transfer.But when changed the application server it worked perfectly. what could be the issue? Is it an IIS configuration issue ,Server configuration issue or any other..
Thanks in advance
|
|
|
|
|
Hi All,
After spending ages on google trying to understand & recify my problem, and having no success, I am hoping someone here can point me in the right direction.
Here is my problem...
I have a windows form, which has a selection of standard toolbox controls and custom User controls, some of which are added at design time & some of which are added at run time.
This all works fine, but when I close the form I get this message:-
"Cross-thread operation no valid: Control 'chkShowSparesMatrix' accessed from a thread other than the thread it was created on".
This control is a standard MS check box which is added at design time. None of its properties are changed in code, the only event which is acted upon is 'checkedchanged':-
private void chkShowSparesMatrix_CheckedChanged(object sender, EventArgs e)
{
if (chkShowSparesMatrix.Checked)
{
usrSparesMatrix1.IsStandAlone = false;
usrSparesMatrix1.Visible = true;
}
else
{
usrSparesMatrix1.IsStandAlone = false;
usrSparesMatrix1.Visible = false;
}
}
If I remove this control, I get the same message on another control.
If anyone can throw light on this for me I would be grateful, or if you need more info to understand my problem I can forward you this.
Thanks in advance,
Janet
Lady Programmers are a rare breed!
|
|
|
|
|
And are you doing anything in another thread?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
The only thing I do on another thread is 'faxing', which is subject to the user saying they want to 'fax' a document, so this doesn't always get fired, unless they answer Yes to a series of questions.
I get the error message, regardless of choosing to Fax or not!
Lady Programmers are a rare breed!
|
|
|
|
|
Have a look at the link that 12Code gave you. I haven't looked at it, so don't know if it will help. If it doesn't help, feel free to come back.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks - will do
Janet
Lady Programmers are a rare breed!
|
|
|
|
|
My first step was to comment out all references to 'faxing' (this was the other thread in my form) and I still get this error.
So now I am confused
Janet
Lady Programmers are a rare breed!
|
|
|
|
|
The only thing that makes any sense is as 12Code said in his OP. Somehow the 'faxing' thread is getting started, and then causes the error when you close the app.
What sort of threading are you using? Is it a BackgroundWorker , or are you creating it in code?
Whichever type, one way might be to handle the FormClosing event of your main form and close/de-activate the thread there.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I am using 'System.Threading', the code is below:-
private void FaxEngineersRequest()
{
try
{
}
catch (Exception ex)
{
_commonValidation.DisplayErrorGracefully ( ex );
}
}
As you can see I have commented this part of the code out - so it will never run, but I still get the cross thread operation not valid error.
<blockquote class="FQ"><div class="FQA">Henry Minute wrote:</div>Whichever type, one way might be to handle the FormClosing event of your main form and close/de-activate the thread there. </blockquote>
Not quite sure how / if / why I need to do this
Janet
Lady Programmers are a rare breed!
|
|
|
|
|
If your 'faxing' thread does not run, and it certainly shouldn't from the code you posted, then there has to be another thread running to cause the exception.
If you don't know about this thread, you obviously cannot close it in the FormClosing handler. You might however put a break point there and use the debugger to search for the 'Thread With No Name'. I would suggest Googling for 'Debugging Threads C#' for methods to do this.
As always, come back if no joy.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
For completeness of this message - I have now fixed my problem.
I made a STUPID mistake...
Rushing to finish the project I had put Close() inside the formclosing event!!!
Won't be doing that again in a hurry
Lady Programmers are a rare breed!
|
|
|
|