Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
I have Custom Control(Checkers) and User Control(Board) in my project.
 
But, I can't add Checker to Board.
I drag and drop Checker to Form1 , then add the checker to board in Form_Load, this codes;
Panel a = board1.AddControl(); //AddControl is Event in Board Control
a.Controls.Add(checkers1);
 

But this code isn't add the checkers;
Checkers b = new Checkers();
a.Controls.Add(b);
 
How can I add Checker in User Control while application is running?
Posted 8-Dec-12 13:55pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I don't know what you've written in Checkers ??
but what about this..???
Checkers b = new Checkers();
b.Size = ???
b.Position = ??? // X and Y coordinates
b.Visible = ???
Set this kinda properties and give it a try Wink | ;) GoOd LucK mate Smile | :)
  Permalink  
Comments
tazugur at 9-Dec-12 5:15am
   
I already wrote them but didn't write it here.
Krunal Rohit at 9-Dec-12 5:16am
   
provide your entire code...
tazugur at 9-Dec-12 6:09am
   
checker[0].Size = new Size(50, 50);
checker[0].Location = new Point(300, 300);
checker[0].BringToFront();
Panel a = board1.GetBoard();
a.Controls.Add(checker[0]);
 

But this code isn't add the Checkers.
 

How can I add Checker to Board (User Control)?
Krunal Rohit at 9-Dec-12 6:12am
   
I get to see your code... Please post the code..
tazugur at 9-Dec-12 6:39am
   
I sending my project.
http://s2.dosya.tc/server23/AiTTMn/Backgammon.rar.html
Thanks for help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 6,725
1 OriginalGriff 6,696
2 CPallini 5,315
3 George Jonsson 3,589
4 Gihan Liyanage 2,650


Advertise | Privacy | Mobile
Web03 | 2.8.140921.1 | Last Updated 8 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100