|
Hi All,
my program requires the user to open a specific text document with fixed values inside and clicking plot will plot the values from the text document onto the pictureBox. I need help in where if the user didn't open the text document and clicked the plot button, an error message will show from the MessageBox and requires the user to locate and open the text document. Any help will be appreciated!
Thanks
P.S I'm new so i'm not sure how to attach a picture so i used tinypic link [IMG]http://i41.tinypic.com/2elgjur.png[/IMG])
|
|
|
|
|
You will need to read the text file, get the values and store them in an array or another construct.
You can then plot a graph inside the picture box using classes from System.Drawing.Drawing2D .
As far as checking whether the file has been loaded or not goes, set a boolean when the text file is read.
If the user clicks on plot and this flag is not set, it means the file has not been loaded.
Simply show the error message.
|
|
|
|
|
Thank you all for your help!
|
|
|
|
|
As an alternative to Abhinav's suggestion. you should set the plot button's Enabled property to False in the form designer. Then, in your program, when you have successfully read and parsed the data file, set it to True . In that way, the user can only request a plot when you have some valid information.
Veni, vidi, abiit domum
|
|
|
|
|
Thanks for your help!
|
|
|
|
|
Which is Best? MVVM and MVC?
|
|
|
|
|
Both are different and cannot be compared. They have different uses.
MVVM was designed to make use of WPF and Silverlight's databinding characteristic, whereas MVC has been around as the traditional controller view separation approach.
|
|
|
|
|
As we are just starting the painful process of changing from Silverlight (MVVM) to ASP.Net (MVC) I can tell you the differences are HUGE. As Silverlight now has a limited lifespan (despite rumours) and we have to deliver via the web we have no choice but to go MVC.
The most glaring difference is that Silverlight/WPF requires 3 basic platforms to achieve great LOB apps, TSQL, C# and XAML.
ASP.net requires a whole raft of different tech, TSQL, C# of course, HTML, CSS, Javascript and a couple of JS frameworks, we are using Telerik tools that need their own Kendo framework and I can almost guarantee there are some I don't know about yet!
So unless you already have ASP.Net and javascript you have a rather nasty learning curve in multiple tech to work through. It makes the learning curve for XAML binding look trivial.
Given a choice I would go WPF and MVVM rather than ASP.Net and MVC, but they are completely different delivery platforms.
And if I could rip the head of the a***hole who canned Silverlight I would feel quite justified.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
It's worth mentioning that Microsoft has a framwork called "MVC" which is part of ASP.NET, this is unfortunate naming as, although it is an implementation of the MVC pattern, it is a specific technology so you need to state state whether you mean "ASP.NET MVC" or "the MVC pattern". There are plenty of articles about MVC and MVVM, so if you want an introduction to the basics, then googling those is easy.
Assuming the patterns: Neither is "best", both are acceptable technology choices, you need to decide which is most applicable to you. MVVM is considered by some/many as a sub-pattern of MVC, where the view model takes some/all of the lifting the controller is supposed that relates to handling to do in MVC but remains specifically a model of the view data/commands etc. At the very least MVVM should be seen as a progression from MVC. Quite often in MVVVM something is needed to replace the controller's orchestration/data accessing functions so in practice you often see controller-like classes bleeding in to MVVM. Likewise having a model of the view is handy, and unit testable so you also see the "vm" part bleeding in to "MVC" apps, or at least the ASP.NET ones I have worked on. SO has a discussion of the two patterns here[^], the first answer "Sorry to have to disagree with such a highly voted answer..." gives quite a bit of information on this topic, the discussion also contains the following quote:
Josh Smith If you put ten software architects into a room and have them discuss what the Model-View-Controller pattern is, you will end up with twelve different opinions.
When I've written WPF and silverlight apps, MVVM has fitted hand-in-glove, so if you are using these technologies you should use those, but as I say, you either end up adding data access & orchestration into the VM (breaking the Single Responsibility principle) or you start adding controller -like classes. That said, I've generally coupled WPF apps to WCF services, and I've had them present data that could use tech like automapper to convert to VMs.
|
|
|
|
|
I have a third party chat application where user will chat using this application.
We have one more application which was developed in C# and which provides details of account by providing the account number.
My requirement is need to read the contents (account no) from third party chat application and open the account details of entered account number in the Chat.
Is this feasible? How we can implement this.
Cheral
modified 27-Sep-13 8:17am.
|
|
|
|
|
Your best bet is to contact the people who wrote the Chat Application you are trying to integrate with.
There are a few things you can do yourself, such as looking for the account number being stored in some sort of file, but it is a longshot.
If you can't get the vendor to provide information and the account number is stored in memory then you've got real problems, so I'd exhaust the above first.
|
|
|
|
|
If the chat system has a log stored on the local driver (or on the server and they are willing to share it), you can read this log.
|
|
|
|
|
Hello all,
While implementing a abstract class, when we override a method, why do we use base.Method() call first and then implement the method? Why this is considered as good practice? When I am sure that I don't want to use any of the variables nor any changed properties from base method.
And Why override is preferred over new keyword? One solution is: 'New' creates new instance of method whereas override uses same memory location. any other suggestions are welcome.
public abstract class A
{
public void method()
{
// Concrete method
}
}
class Class1 : A
{
public override void method()
{
base.method();
}
}
This question was asked during my interview. Please suggest.
|
|
|
|
|
We call the base class method from the derived class method for the simple reason that it does some work that the whole base class (and by implication all derived classes) expect to have been done!
For example, if you have an abstract Fruit class, then the Picked method will probably set the abstract class field value "datePicked" to the current date - so that you can use it later in the GetBestBeforeDate method. If your derived class overrides the Picked method, then you must set the "datePicked" field correctly, or future abstract class methods won't work properly. Calling the base class implementation is the easiest and most reliable way to make this work properly.
Why use override? Well, again, it is so that things work correctly!
new hides (or replaces) the base class method, override extends it. What that means is that if you declare a derived Fruit class Apple, and it has the Picked method we talked about:
Apple a = new Apple();
Fruit f = a; Then we call the Picked method
a.Picked();
f.Picked(); The results differ depending on how Picked was declared in the Apple class:
If Picked was an override method:
The two lines call the same method: Apple.Picked because you extended the method.
If Picked was a new method:
The two lines call different methods: the first calls Apple.Picked, the second calls Fruit.Picked because you replaced it
If you aren't sure of this stuff, then you do need to learn it - look back at your course notes, or read up on MSDN because it is pretty important to know what is going on here!
The only instant messaging I do involves my middle finger.
|
|
|
|
|
Thanks, very good explanation.
|
|
|
|
|
You're welcome!
The only instant messaging I do involves my middle finger.
|
|
|
|
|
ankum16 wrote: we use base.Method() call first
You don't have to, it depends on what you are doing, I find that I rarely do that.
|
|
|
|
|
I'm trying to display a copyright symbol and am getting strange results as follows.
using ©
firefox = copyright
chrome = heart
IE - heart
using ©
firefox = copyright
chrome = heart
IE - heart
using Ó
firefox = opera sign
chrome = copyright
IE - copyright
Font is Calibri
doctype is
Don't know where to go as googling has got me to the japanese language sites without an answer!
|
|
|
|
|
Errm, what has this got to do with C#? You should be asking this in the web forum.
|
|
|
|
|
|
With Html5 you can use &trade ™ or ® ®.
|
|
|
|
|
Hello everyone,
I have a course project and i need your suggestions that how I can implement it. Basically I have to find pdf files on web. these could be free eBooks for students. So user only have the name of book or keywords and results will be best matched free pdf file links. Now I dont know how I should crawl the web. I have a list of free eBooks websites. May be those are enough.
I have searched and tried to use Google custom search api but I am not successful, may be it is too complex and also I was not sure that it would help or not. I will be very thankful if you have a good and quick suggestion for me because I have to start it asap.
Thanks in advance.
|
|
|
|
|
|
Thank you for your advise. I have successfully implemented the Book search using the api. But in my project work I have to search pdf files only on web. And I have red whole description of api but did not find anything that can implement it. Also I want to save the result links in a file. But there is no option to handle the results. May be I have misunderstood it. Please guide if you know anything.
Thanks in advance
|
|
|
|
|
I would start by studying this[^] article and its code.
|
|
|
|