how can i switch between 2 window forms? In my Form1 i have a button and if i press
it should open Form2 and close the Form1 i can open the Form2 but if i try to close the first form
it wouldn't work
probably a stupid question but i'd love to know how it works
i think i have to use some MDI functions...
but i don't really have the code...
i know i can make a new form with:
Form frmname = new Form();
and show it with frmname.Show();
but thats not the form i want to load...
i made a new "Windows Form" with "Add New Item" so you can see a Form2.cs in the solution explorer... and i want to switch from Form1 to Form2 if it's possible.
Given your really good description (it wouldn't work) I can only guess what is happening. I think that Form1 is your startup form. If you close it the whole application will close.
There are several possibilities:
1. Hidden startup form
- Make a hidden Form which is your startup Form (that one mentioned in the Main method).
- In it's constructor/Load-event open up Form1
- Now you can safely close Form1 without terminating the application
2. Don't switch teh Form - just its contents
- If the two Forms have matching size than you could create two user controls instead and add/remove them from the startup form.
The question is, how is the HTML data formatted? What type is the HTML data, in your .NET code? If it's binary, you'll need to convert it from byte to string using System.Text.Decoder and its derivatives.
Your problem is you are interpting the "normal data" to mean "string" which if it is in the form of Html *is not* string at all. After all, this page is all Html and it has far more stuff than just "string". So what is it that you are really after? If you just want to do raw text processing you might want to look at WebRequest/WebResponse instead.
I'm getting very often but not always some kind of error dialog when I quit my app in C# that uses some COM objects. Unfortunately I can't tell what it is because when it pops up the application closes in like 10th of a seccond and I can't see what's the dialog about. This is release build. Debug doesn't report anything in debugger on exit ever. I understand it's very vague but I still need help and hope someone here can help me. How to catch the error?
Thanks a lot for help in advance!
I too periodically see an error dialog flash when I quit my application. It seems to have started after I overrode WndProc to perform some custom drawing in a List View control, and doesn't seem to occur with any consistency. My gut says the window handle is being disposed while some of the painting routines are using it, but in all honestly I don't know enough and shouldn't even speculate.
If you find a way to "capture" what the error dialog says, let me know.