|
Shouldn't the extension added to the file depend on the currently selected file filter. The filter in this case is .txt.
|
|
|
|
|
sarithasj wrote: Shouldn't the extension added to the file depend on the currently selected file filter. The filter in this case is .txt.
Shouldn't you be checking what the documentation says about it?
as in "Gets or sets a value indicating whether a file dialog automatically adds an extension to a filename if the user omits an extension."
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hello Friends
i need help, i m using picture box for drawing the graph. so for that i m using paint event of picture box to draw an image. but problem is that when i minimize the window or any other window come on top then the image gets lost.
So wht should i do so that i can get my image afain after maximizng the window
And one more thing that is it possible to store the picture box image in any other object.
Thanking You All !
Avinash Patil
|
|
|
|
|
Hi,
Typically the PictureBox is used to display graphics from a bitmap, metafile, icon, JPEG, GIF, or PNG file. I think you need a graphing control. You may want to look into http://www.codeproject.com/KB/graphics/zedgraph.aspx[^] which I've seen recommended on this forum previously.
Alan.
|
|
|
|
|
Whenever an event occurs that may disrupt the graphics of the picturebox, be sure to call picturebox1.Invalidate(). This will for the picture to repaint itself. If you are doing custom paint routines it is usually recommended that you create a new custom user control.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Hello Thomas
Thanks for replyng
Actually problem is that, i want to store the image of picture box in a object so that when it gets repainted because of minimization of picture box or any other window comes above it. So that it will reduce the time to redraw it. And one more thing to tell that while drawing in the picture box, there are near about 400000 points. and because of that its taking so much time.
Regards
Avinash Patil
avinashpatil3484@gmail.com
|
|
|
|
|
you could assign the contents of the picture box to a Bitmap Object...
manipulate the Bitmap object via setpixel and getpixel
and the assign it back to the Picturebox
Does this help?
|
|
|
|
|
I need to do something simliar to what you did. I can get the service installed and running but my timer is not firing.The OnStart and OnStop code is firing ok so i know the service is running.
I am using vs.net 2005 btw
Chandhu
|
|
|
|
|
What are you talking about ?
|
|
|
|
|
Hi Guys
I am working on a WinForm Project (VSS2008) with SQL Reporting Services (SQL Server 2005). I have multiple reports that need to be printed ad-hoc. So far, I have placed each report into a seperate windows form and render the report within this form. Once referenced, these forms can be called from anywhere in the project using the Form.ShowDialog() method. Once the form is rendered I call ReportViewer.PrintDialog() to pop up the print dialog. This all works fine.
The Developement Specs asks for the form to be printed automatically. That means then when the form is called, it must render and bypass the print dialog, and then print the report (.rdlc) automatically. I have been struggling with this for a while now. I am still new to development and hope that someone can help me.
Basically, is there an easy way to programmatically trigger a Report Print (like clicking print on the Print Dialog) once the report has been rendered?
Thanks is advance.
|
|
|
|
|
I am working on a gaming project. The code has been migrated from .Net 1.0 to .Net 2.0.
I am using Sdldotnet in this project. Sometimes when action was not complete, the game crashes and error message is shown "Send or Don't Send". The error is
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Suggest me something that helps me out of this.
Thanks in advance.
Prateek
|
|
|
|
|
Looks like an authorized access taking place. Bad news for you is, it can be due to anything and you would have to debug it. If you can reproduce the steps of the crash then your lucky(you have some lead) or else add try/catch in your main and see if the stack trace helps in providing some lead!!
|
|
|
|
|
I'm probably missing something obvious, but here's my problem:
I'm using VB.net to deal with large text files (mostly vertical lists and some used as data sources). When I save the file from my app, I end up with a blank line added to the end of the file (File.WriteAllLines...) because of the line terminator from what should have been the last line. I need to eliminate this.
If I use "File.WriteAllText" or "StreamWriter.Write(String)" the extra line is eliminated, but MS NotePad then renders the file as one long string of text (NoteTab and my own app render it properly).
If I use StreamWriter.WriteLine in a loop (thru the lines of the RTB) - it works okay for small files. But some of the lists I'm working with here have thousands of lines and this takes forever. The largest file to date has 80,847 lines.
I'm thinking this should be easy to solve, but I've not solved it. I just need to write the contents of a RichTextBox to a file with no extra blank line at the end, and in a manner that all Windows text editors (including NotePad) can properly read. I'm not doing anything fancy or complicated here, just editing text.
|
|
|
|
|
richTextBox1.LoadFile("test.txt", RichTextBoxStreamType.PlainText);
richTextBox1.SaveFile("test1.txt", RichTextBoxStreamType.PlainText);
When I load and save a file using the above code I create an identical copy. If you don't see the same then any editing you are doing must be adding the extra line.
Alan.
|
|
|
|
|
Thanks Alan.
Not sure this will help me. I may have an issue with chr encodings going this route. Didn't think about this simply because I hadn't used it in a long time. Will give it a whirl.
|
|
|
|
|
use Environment.NewLine when writing a line to the stream. It will work for you.
string.Format("{0}{1}",'your Variable', Environment.NewLine)
Krishna
|
|
|
|
|
Hi, i'm looking for a way to bind a BindingList<customerviewmodel>
to a grid... (allow adding a new row in the grid).
If i'll use BindingList<customermodel>, i know it will work...
but binding to he ViewModel allows me to add additional presenation logic to the class.
How did you solve this?
Thanks in advance,
Erik.
|
|
|
|
|
Hi,
First I implemented a bindinglistview which inherits from the BindingList and implements all necessary interfaces such as IEditableObject, etc. From there I used this in a custom collection that takes care of the Adding New logic. All of this came from the Data Binding with C#2 book but I cannot remember the author at the moment. Great indepth discussion in a single chapter on how to bind with objects. It also works well with the Interface during design time.
Happy Coding
|
|
|
|
|
Thanks for the helpful reply! =)
I've explored this subject some more, and came across the CSLA.NET framework,
As it seems the framework implementation does exacly that =)
I'm still learning it, but it looks promising...
Did anyone use this framework and implemented the Presentation Model pattern???
It seems rather cumbersome to wrap the CSLA entities with ViewModels, because them the ViewModel will have to implement all the interfaces and forward any calls to he CSLA entities...
(And of course the ViewModel will have additional logic to help support the UI and DataBinding)
BTW,
If i'm not using the Presentation Model Pattern, and I have this rule for example:
The row of a customer in a grid must be green if the customer ordered more than 10 items, at a price higher than 20$.
If i'm using Presentation Model, then my customer's ViewModel will have a property OrderedMoreThanTenItemsAt20DollarsEach (for example), which will implement this logic and the view will use DataBinding to bind the rows color property.
How will i implement this using the Supervising Controller pattern?
(I guess passive view will just iterate through the rows in the grid).
Thanks in advance,
Erik.
|
|
|
|
|
The CSLA Framework from Rocky has been around a long time. Rocky has updated this for many years and a lot of companies use it. My understanding is that it is very good. There are other frameworks as well that might be used such as Smart Client Software Factory, Web Client Software Factory, ASP.NET MVC and the brand new PRISM for WPF and Silverlight. Personally, I have been sticking to the Microsoft Patterns and Factories. Then my model, my presenter, my view and/or controllers can be reused between them.
All of these have things in common. The model, the view and the presenter or the controller. I personally like MVP since it truly encapsulates the actions, rules, transitions and translators into a reusable framework that can be used and easily adjusted as requirements change. If there is one thing for certain in this world - requirements change as the users or management see things evolve. The ability to know where to go to make these changes without Spagetti Coding is crucial to success.
It appears that you have a good handle on the tiers here and their requirements. So here is my take. This is only my take and not a definitive answer. So if it is usable then hey use it, if not applicable to your case, file it away for later. The supervising controller is used to centralize the methods between views. All events that can be shared should be fired up to this controller and the controller in turns then fires commands back to interested views. It is very useful for keeping the views of data synchronized on the same class. So supervising controllers listen to events and fire commands to controllers which in turn fire the view events. Now you have a loosely coupled set of views that can be reused between modules without having any dependencies to any one parent container. The supervising controller handles the work and the actions, the view is merely a container with very few methods and the controller for the view has specific methods and interfaces to make the view do things. The controllers talk to the model and obtain most of the data then rearrange it as necessary using LinQ to Objects or if you are using generic list then use the predicates to handle the where clause etc.
All views in turn should handle the same interface so the controllers fire things in a coordinated fashion. It keeps you from getting confused as to what to do. Over time you will see exactly how to do this and it will become automatic.
Some of the model patterns that I use are the abstract factory pattern for the repository objects, a command pattern for reusable commands, a facade pattern for the method calls to make it easier to move this. Regardless of which framework you use the repository and the model do not change significantly. Now you can loosely couple everything and hook up the data with Enterprise Factory, nHibernate, LinQ to SQL or ADO.NET Entity Framework.
Finally, all UI classes should be wrapped with a BindingListView<t> so that all interfaces to the classes are exposed in a single location in the correct way.
I hope that this helps.
Best regards and keep working on it - this is definitely worth it in the long run.
|
|
|
|
|
my actual task is to read the EULA from the .exe file and copy it to another file. i hope this question relates to this forum. please help me to solve this.
|
|
|
|
|
There is no EULA in calc.exe.. Lots of applications consist of multiple executables, and they load libraries that might have their own license. I'm using a spellchecker in my executable that's licensed under the CodeProject-license, but the main executable isn't.
An assembly might be licensed, but I doubt that the complete text will be embedded as a resource. I'm not going to say that it can't be done, but it would be at least challenging to do such a thing.
I are troll
|
|
|
|
|
thanks for ur reply. i just want read the EULA using my program from the softwares that are asking for the user acceptence while instaling them. hope you get my point.
|
|
|
|
|
Yeah, all too well. I was a fanatic World-of-Warcraft player, and Blizzard has the brilliant idea that every player needs to accept three licenses, for each and every update! Needless to say they update a lot, and you can't click it away - you need to scroll to the end to ensure that "everyone reads it". I'm sure that all those kids read it and carefully review the advantages and disadvantages of each license
There's lots of software on my system, and since I don't speak the law-lingo, I can't make heads or tails out of them. Unfortunately, there isn't a common place to put them.
Even hooking (to catch all installers) wouldn't give you all the licenses.
..but, you can get a list of currently installed software. You might not get the license automagically, but you could start working on a database that holds the licenses for the most common software. It would actually be sweet if there were a website where one could retrieve the license that goes with a software-package, along with a "human readable translation".
That would indeed be awesome
I are troll
|
|
|
|
|
hi thanks for your valuable information and for sugestions too. see you soon with more douts
|
|
|
|