I am using the following way to determine if the email was sent successfully.
SmtpClient smtp = new SmtpClient("127.0.0.1"); // We Just use the Local host
smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis; // This is to check the IIS
emailSentSuccess = true;
emailSentSuccess = false;
private void button1_Click(object sender, EventArgs e)
//Copy the contents of the rich textbox to the clipboard
//Open the clipboard
//int i = 0;
//bool done = false;
//int formats = new int ;
//while (! done)
// formats[i] = EnumClipboardFormats(i);
// if (formats[i] == 0) done = true;
Metafile MF = new Metafile(GetClipboardData(2), true);
When all that I copy into the richTextBox is an image (from the clipboard using alt-Print Screen), the commented out loop returns only one format = 2. The attempt to create the Metafile generates the following error: A generic error occurred in GDI+.
I want to make a Wizard in Windows Application in the same form. Now, I am realizing that, ASP.NET's MultiPage Control is missing for Windows Forms and I am not sure if there is any 3rd party control available which is similar to ASP.NET MultiPage control. In Flash, I could use so many frames to switch back and forth but Alas, In .NET Windows development, I cant do that. Would anyone please give me a suggestion about it ? '
Actually Tab Control serves the purpose in the HALF way as it gives the user to switch the pages using GUI. But I want that, the user will not see the Tab control's Tabs, rather only I will switch them programmatically. Is it possible somehow ?
I tried setting Empty String for Text property but it does not work. Still tabs are shown with no texts on it. If tab control had a boolean type property like "HideTabsFromGUI", then it could be the perfect solution. Is it possible to implement this by inheriting the tab control ?
Using so many panels in Windows Form and showing one at a time is never an easy task. Because, whatever panel I will intend to show, I will have to programmatically relocate it (Size and Position) in the Windows form and that is not charming at all.
So, I am just thinking only about creating a custom control inheriting from Tab Control. But can you help me to do this ? I mean, how I can hide the tabs ?
Using so many panels in Windows Form and showing one at a time is never an easy task.
Emran Hussain wrote:
programmatically relocate it (Size and Position)
I don't agree: rather than inheriting from something that does not do things the way you want
(basically is too complex), I suggest you build it from simpler things. So make a little class (say
MultiPanel) that inherits from Panel and that holds a List of Panels. All the Panels in the List are
added to the Controls collection of MultiPanel, all same size same location, but only one has
Now give it some properties:
- a Bounds property, that sets the Bounds of each of the Panels
- a SelectedIndex property, that sets all Panels invisible except the one with the matching index
and some methods, including:
FYI: An invisible Panel does not show its contents, and does not consume events. So the whole thing
behaves like the one Panel that is selected. No more, no less.
And if you want to design your panels with Visual Designer, just make them separate classes,
inheriting from Panel, and add them as per above, except you now need a method AddExistingPanel(Panel).
I meant, Microsoft could do this work for us, like they did make MultiPage Control for ASP.NET, same type of control they could make for Windows Forms too! As Creating Wizard is very common type application and I am wondeing how the developers are handling this problem ? Are they creating their own custom control as you described !!!
A button does not hold any data (unless you hide something in its Tag).
The normal approach is to have your data structured somehow and stored in class members.
Then these data may get operated upon by Controls, such as a Button causing an OpenFileDialog to
appear, and a file being read; and an OnPaint method may read the same data to display something
on the Form or one of its Controls (such as a Panel).
I have a user control (which for the purposes of this post is just a container), and several nested user controls. I want to lay out the child controls inside the container in a similar way to the following picture:
I've tried different combinations of Anchor and Dock properties as well as using a Flow Layout Panel, but I can't get it to work.
The two things I know are:
1) The location of each child control on the Y-axis
2) The height of the control
I need some way to assign these controls a combination of properties and have them stack up as shown in the picture. Full width child controls should float to the left, and if there's more than one child control at a Y location (eg: 3 and 4), the available space should be split.
I managed to get it sort of working, but items were overlapping.
Have you looked at adding a SplitContainer into the mix?
I'm thinking that if you dock one panel on the left side of the form (or control), dock a second panel in the upper-right, a third panel in the bottom right, and place a SplitContainer into an area you leave open between the two panels docked on the right, then you can place your #3 and #4 controls in the split container panels, and not worry about any overlap. You could set the IsSplitterFixed property to True to prevent the user from resizing the split, and make the splitterwidth small enough that it is unseen.
Anyways, that is one idea, I won't be surprised if there are better ideas...
yep, do it hierarchically, i.e. split your form in two parts (that would be 1 versus 2+3+4+5) using
either a SplitContainer or two Panels; give those the right anchoring.
Then iterate for the next split (5 versus 2+3+4). Etc.
Thanks for the quick response. I didn't explain myself very well. The number of child controls isn't a fixed value. In the example there are two items with the same Y value, but there may be just one, or four or five.
I don't know which Control would help you split a distance in N equal parts, N being possibly larger than 2 and not a power of 2.
The way I used to do all these things, before I was even aware of anchoring and SplitContainers, is
by calculating Top, Left, Height and Width myself, by code, in the OnResize handler. Takes some code,
but does exactly what you want with no additional Controls to achieve your layout.