|
I want to use the:
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
}
what do I add in the #region Windows Form Designer generated code
private void InitializeComponent()
{
}
Something like:
this.OnClosing += new System.Windows.......
Thanks
Thomas
|
|
|
|
|
Open the form in design mode.
Select the form and pull up the property window.
In the top of the property window you will see a lightning bolt; click it.
Now all events for the form are visible.
Locate Closing, place cursor in open box, double-click.
Your method signature and your delegate registration is done for you.
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
Hi,
I am beginner in .NET world. may you give the right address of such "lightning bolt" ...
I have VS.NET 2003, where can I find such thing?
Thanks
Fari
|
|
|
|
|
I am using VS.NET 2003 as well. But the directions remain the same regardless of version.
Just as I said:
Open your form and select it in the designer window.
Select the properties page.
Click the icon at the top that is a lightning bolt.
There is no address per se.
|
|
|
|
|
OnClosing is marked as virtual . The framework code calls it when the form is closing. There is nothing to monkey with in the Designer section since it will be called whether you override it or not.
|
|
|
|
|
The event is Closing and the delegate type is CancelEventHandler . Without using the VS.NET, you add a line like so:
this.Closing += new System.ComponentModel.CancelEventHandler(MyMethod);
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am developing an application that is primarily keyboard not mouse driven. Navigation is very difficult within some controls (list boxes, radio groups etc) unless the focus rectangle is visible. When an application starts the focus rectangle for a control is never visible and only becomes visible once the TAB key is pressed. After that everything works OK. In a list box I have looked at the ChangeUICues event of the control and there is a read only property ShowFocus which indicates if the focus rectangle will be displayed. Is there a way to set this to yes? Ideally what I need is if I have a form with one list box control, with say 10 items listed, that it starts with the focus rectangle around the first item without having to press TAB.
Any help greatly appreciated.
Regards
Stephen
|
|
|
|
|
I just built a simple app with a listbox in it and kept playing with what was needed to accomplish what you want. I ended up with
this.listbox1.Selected();
This put the focus rectangle inside the listbox.
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
Thanks for your reply.
I could not get your suggestion to work. I created a new project. Dropped a list box on the form. Created 5 items using the items collection in the IDE. Put
this.listbox1.Selected() in the load form event first and then the list box enter event. In both cases I got the items displayed with no focus rectangle until I press TAB.
Where did you put the this.listbox1.Selected() statement?
Regards
Stephen
|
|
|
|
|
It is in my Load logic. But I am using Select() not Selected()
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
Thanks again for your help.
I was also using Select() in my form load event.
Can you email your project? I must be doing something wrong or maybe you are using a different version of VS.Net. Are you doing this in a Windows or Web form?
Regards
Stephen
|
|
|
|
|
Can someone tell me how to create the certs for Quickbooks integration. I'm using IIS 6.0 and I already have a verisign cert so I can't create a request cert for intuit. I have a web app that i'm hopeing i can integrate quickbooks with. There is a SDK for this but it's geared toward Java apps. Any help is appreciated.
|
|
|
|
|
Hello,I am Adding 5 tables one by one into a HashTable with tablename as value and "Select * from tableName where PrimaryKeyFieId = -1" as Key.Now I want to add it in the order I have written the statements but it is taking in some specific order.If anyone can suggest solution I would be grateful to him/her.
Bugfixer
|
|
|
|
|
A Hashtable doesn't care about order. It's uses hashes to place items in buckets and resizes itself when needed. This is a relatively simple data structure that is taught in most beginning and intermediate programming classes.
Instead, use a System.Collections.SortedList which also impements IDictionary .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How to read Ladder diagrams using C#? Is there any way to insert ladder diagrams in .rtf file?
please guide
|
|
|
|
|
Same as any other document: write a parser than displays objects. Since there doesn't appear to be a standard for a ladder diagram document, you have to design your own data structures. This is really no different than what charting applications would need to do. Using .NET runtime serialization with an abstract object model would probably be best. The implementation is entirely up to you.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
could you please elaborate more.
thanks
|
|
|
|
|
As it turns out, there's one standardization project currently in design phase. See http://www.bbdsoft.com/control.html[^]. It uses an XML document to save the ladder logic. In this case, it'd be better to use XML Serialization (see the System.Xml.Serialization namespace in the .NET Framework SDK), but to still design an abstract data model where the objects are still drawn on the screen using suitable representations. There is a Java project already using this recommended spec I linked above if you want examples. See http://www.bbdsoft.com/j-ladder.html[^].
It's amazing what a simple search for "ladder diagrams" on google[^] can turn up.
As far as embedded this in an RTF, the easiest way would be to allow your application to draw the images to a device context instead of the screen device context and then save that to an image. Simply embed the image in RTF. Attempting to use OLE requires a good working knowledge of OLE, how to embed OLE in RTF, and how to expose CCW effectively from .NET components.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Images won't help here, as, if we compress the image of ladder, the thin lines may disappear and the ladder become useless.
regards
|
|
|
|
|
Look, there is no library for reading or writing ladder diagrams for .NET that I could find by doing a quick search on google, which you really should've tried first - researching is just part of development.
You have to write your own. As I mentioned, there is an XML dialect being designed for a standard document format, but nothing says you have to use it. How you implement this is completely up to you. This is all part of designing an application.
I gave you a couple ideas. You can use images and can even use vector graphics like EMF, which .NET can save. This means that if the image is scaled up or down (down to a degree, but that's pretty small) it looks the same because the strokes and shapes are recorded, not simply pixels. EMF is an enhanced version of WMF.
If you want to know how to embed OLE objects and expose your drawing surface as a CCW, then you need to read a heck of a lot of documentation about OLE, COM, and CCWs in .NET. The former approach is much easier and supported by more RTF viewers (even on different platforms), where OLE would not.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello!
I'm having some trouble geting one value (and only one) from my cookie, and would realy appreciate some help. This is my code:
HttpCookie UserCookie;
UserCookie = new HttpCookie( "strUserID" );
UserCookie.Values.Add("group", "1");
UserCookie.Values.Add("sim", "2");
Response.Cookies.Add( UserCookie );
How do I get only "group"?
Thanks!
-- Evil geniuses for a better tomorrow --
|
|
|
|
|
If you read the documentation for the Response.Cookies property (rather, the HttpCookieCollection class that Response.Cookies reflects), it should be obvious:
string group = Response.Cookies["group"];
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How can I do this.
I use \n in the header. But it doesn't show the second line.
thanks in advance.
|
|
|
|
|
You need to use html to affect the layout when rendered to the browser, so in this case you should use either <br/> or <p>...</p>.
You will probably find if you view the source of your page that it has put the newline in there but, as the browser will ignore the newline, it doesn't do you much good.
HTH
|
|
|
|
|
sorry I forgot to say, I need to do this in C# windows application.
|
|
|
|