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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Scott LysleRank #49 · 31K reputationPosted Nov 15, 2007, 5:49 PM EST
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".