ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 11th, 2003, 02:07 AM
sushant sushant is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 1 sushant User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Red face Dynamic Buttons

Hi,
I am creating a number of buttons on the form on a particular event using VB.net.

Source Code for adding button is as follows:

Private Sub AddButtonToThisApplication(ByVal x)
Dim btn1 As New Button()
Me.Controls.Add(btn1)
btn1.Left = 0
btn1.Height = 25
btn1.Width = 25
btn1.Name = "btn" & x
btn1.Text = x
btn1.Visible = True
btn1.Tag = x
btn1.Dock = DockStyle.Left
Me.Width = Me.Width + 25
Me.Left = Me.Left - 25
fpos = fpos - 25
End Sub

I want to call a function on click event of each button with different parameter.

I used trapping click event on form using "keypreview" & checking the name of src of event, it works fine when I click on form but doesnt work when I click on any of these buttons.

How can I detect click event on these buttons & which button is being clicked?



Last edited by sushant : February 12th, 2003 at 11:23 PM.

Reply With Quote
  #2  
Old February 12th, 2003, 01:27 PM
numbernine numbernine is offline
Up To His Eyes In Ads
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Chicago
Posts: 160 numbernine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 25 sec
Reputation Power: 6
On client-side or server side?

On server side...

Code:
<%
	If Len(Request.Form("button1")) > 0 Then
		Response.Write("You clicked button one.")
	End If
	
	If Len(Request.Form("button2")) > 0 Then
		Response.Write("You clicked button two.")
	End If
%>

<form method="POST">
<p><INPUT type="Submit" value="Button1" id=button1 name=button1></p>
<p><INPUT type="Submit" value="Button2" id=button2 name=button2></p>
</form>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Dynamic Buttons


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway