Hi there,
1)I have to create a conrtol in Visual studio 2005 that will display "hello world" when the button is pressed. 2)load this control from dll into project exe 3)run and test imported control panel
Thanks for your help in advance =]
Hi there,
1)I have to create a conrtol in Visual studio 2005 that will display "hello world" when the button is pressed. 2)load this control from dll into project exe 3)run and test imported control panel
Thanks for your help in advance =]
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Scott LyslePosted Nov 15, 2007, 10:49 PM
Well, you can start by creating a class library; call it CustomControl. To that, add a class that inherits from Label, give the class a public method that will force it to display "Hello World" and then build the control. That much of the code could be something like this:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace CustomControl { public partial class SayHowdy : Label { public SayHowdy() { InitializeComponent(); } public void SayTheWords() { this.Text = "Hello World"; } } }After that, add a windows application to the solution, call it something like TestHarness. Then drop the control you just created with the above code onto the form (it will appear in your tool palette, generally near the top). Then add a button to the form, write a click event handler for the button that will call the custom control's "SayTheWords" method.
Run the application and click the button, the label's text will display "Hello World".