User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 426,346 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,349 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
Views: 14562 | Replies: 4
Join Date: Jun 2005
Posts: 69
Reputation: DotNetUser is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
DotNetUser DotNetUser is offline Offline
Junior Poster in Training

Help Create buttons at runtime

  #1  
Sep 26th, 2005
I want to allow the user to tell me how many rows and columns of buttons to draw. Then draw the buttons. When a button is clicked, it displays the row # and column # of that button in a msgbox.

I would create a button using the following code:
Button myText = new Button();
myText.Location = new Point(25,35);
myText.Text = "First";
this.Controls.Add (myText);

First of all, how would I create a click event if the button name isn't available until runtime? If a button is created in the design view, to get the click event one would double-click on the button.

Would I need a 2d array to store the column/row numbers to retrieve. But how would I know which button is clicked to retrieve the info?

Thanks.
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C# Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C# Forum

All times are GMT -4. The time now is 11:52 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC