|
If you need to change the values, you have three options:
- Remove the
protected modifier from the <set>set accessors. The properties can then be set from any code.
abstract class Polygon
{
public double Length { get; set; }
public double Width { get; set; }
abstract public double GetArea();
} - Add a public method to the
Polygon or Rectangle class to change the property values. This method can then be called from any code.
abstract class Polygon
{
public double Length { get; protected set; }
public double Width { get; protected set; }
abstract public double GetArea();
public void ChangeDimensions(double newLength, double newHeight)
{
Length = newLength;
Height = newHeight;
}
} - If you want to preserve the immutability[^] of the class (Hint: This is almost always a good idea!), you'll need to create a new instance of the class with the new dimensions.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Perfect! That was exactly the explanation that I needed. I'm really disappointed that my instructors were unable to answer this. Looks like I'll be teaching myself...
|
|
|
|
|
This was a great question that led through to a very good explanation. I, for one, learnt something from this discussion.
Keep asking well thought questions like that here and you will learn...a lot!
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
I'm sure I'll have plenty more. Stay tuned!
|
|
|
|
|
At my windows application reporting services project:
I have two reports: reportA and reportB and one report viewer.
I want to change these 2 reports according to my choose from a combo box.
I can display reportA, but then when want to change to reportB,
this error message displays: The source of the report definition has not been definition.
I used :
reportViewer1.Reset();
reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.ReportEmbeddedResource = "TERMINAL_BENDING_APPLICATION.Report2.rdlc";
this.reportViewer1.RefreshReport()
I used everything but still the same. Please help me.
|
|
|
|
|
Please do not cross post.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
hello, i have a question. I have an web application(project A) and console application(Project B), when the user input 3 value in 3 different textbox in Project A and press submit button, how do i run the exe file and pass that value into console application(Project B).
|
|
|
|
|
You need something intermediary. Your best bet in this case being a file. The web app writes to it, the console reads from it. A database would be a good (or even better) alternative, especially if there is already one attached to the webapp.
If this is something for production you'll probably need to some metadata to the file like sessionid, datetime stamp and stuff like that. And you'll need to handle some logic. (which numbers have been processed, don't process things that are currently being written (incomplete), ... )
You could also start your console from the webapp probably and pass the numbers as arguments...
If a console can listen to windows messages you could use that construct.
Hope this gives some ideas.
|
|
|
|
|
Are you saying ... "run the exe file" ... you want the Web Application to start the Console Application each time you want to pass the TextBox content ? Or, is the Console Application always running when the Web App is running ?
« I had therefore to remove knowledge, in order to make room for belief » Immanuel Kant
modified 1-Oct-14 5:55am.
|
|
|
|
|
yeah, I want the console application run every time i pass the textbox content.
|
|
|
|
|
Member 11025924 wrote: I want the console application run every time i pass the textbox content. I think this is a mistake, and Kornfeld explains why, eloquently, in his responses to you.
You might think about having one Application launch both the Console Application and a WebBrowser (using Process.Start), then doing something to notify the Console App when you wish to pass out the TextBox values (FileWatcher ?), but I think there'll be security issues there, also. Allowing a browser to write arbitrary files in local storage is ... an issue.
« I had therefore to remove knowledge, in order to make room for belief » Immanuel Kant
modified 1-Oct-14 5:55am.
|
|
|
|
|
When you user input his values he is on the browser, on his own pc! Do you want to run the console app there? Or post the values back and run the console app on the server?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
|
Some important point...
1. Running exe from within a browser's page is seen as unsafe behaviour
2. In some browser this not supported at all (at least without some add-ins or Java/Silverlight like frameworks)
3. Even in browsers support running the exe it can be blocked by user configuration (and for most disabled by default as a security issue)...
4. The exe you want to run should be installed on client machine - it will not come over the web page
For summary - it smells like a very bad ide/design...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Thanks for the sharing. But it is possible to do it programmatically?
|
|
|
|
|
It depends on the tools you are using...
As much as I know Chorme and Firefox will not let you to do it using only JavaScript, but IE has its ways...
You can create a Java block that will do it and it will work for all browsers (probably)...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: but IE has its ways...
Not any more. ActiveX controls in new browsers are no longer supported.
|
|
|
|
|
I'm glad to hear that!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
euhm, you don't want to do that ...
I propose you find another way. I'm not sure what the console application needs to do, but your best bet is to run it on the server. As I mentioned you'll need some metadata to know who's running the application so it can return the result to the correct session.
No matter how I think about this, it looks like you could do it cleaner then this.
|
|
|
|
|
which is the best method to increase speed of sending a file over lan so we can use all brandwidth alailable to us.will creating many socket connection and breaking file and then sending file over these socket will hlp us or will creating a VPN will be effective or not?
|
|
|
|
|
You could host it on a webserver, and open multiple download-connections from the client, similar to a "download accelerator addon" for most webbrowsers. If there's more than one PC where the data resides then it might be more effective to look into BitTorrent. Basically they are ways of sharing data, all connecting using multiple sockets - something you could also implement yourself.
Do take into consideration that you're hogging the network, reducing resources for all other clients
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
O aplicativo não foi iniciado. (Exception from HRESULT: 0x8027025B)
|
|
|
|
|
Please translate your question to English and add more information (the statement that causes the error at least).
|
|
|
|
|
HRESULT 0x8027025B translates to ERROR_BUFFER_TOO_SMALL .
According to this[^], it could be related to your firewall or anti-virus software.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I didn't realise you spoke Portugese. 
|
|
|
|