473,473 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Creating Run Time Button in VB.NET

13 New Member
Hi,
Please help me.
I want to create a run time button and text box and display some message in text box when i will click on run time created button

Thankx in Advance
Aug 24 '07 #1
1 1267
dip_developer
648 Recognized Expert Contributor
Hi,
Please help me.
I want to create a run time button and text box and display some message in text box when i will click on run time created button

Thankx in Advance
take a button variable
Expand|Select|Wrap|Line Numbers
  1.  Dim dynamicBtn As Button
when you want to create it.....try the following code

Expand|Select|Wrap|Line Numbers
  1.  dynamicBtn = New Button 
  2. dynamicBtn .Location = New Point(10, 10)
  3. dynamicBtn .Font = New Font("Verdana", 8, FontStyle.Regular)dynamicBtn .Width = cmbPfCategory.Width
  4. Controls.Add(dynamicBtn )
  5.  
Now if you want to do something in this button's click event then you have to add Handler for this button control.......add a Handler like following
Expand|Select|Wrap|Line Numbers
  1.  AddHandler dynamicBtn .Click, AddressOf dynamicBtn_click
now put your code for the button's click event as follows.....

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub dynamicBtn_click(ByVal sender As System.Object, ByVal e As System.EventArgs) 
  3. TextBox1.Text="I have clicked the newly created button"
  4. End Sub
  5.  
Aug 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: PK | last post by:
Hello, I am looking for help on the following. I'm trying to create a custom browser toolbar button that will do a few things. One that I'm trying to do at the moment is just simply return the...
1
by: dave | last post by:
I first started using HCW.exe to compile .rtf filew created with MS Word a couple of weeks ago. I used the file | new menu then selected New project in the dialog box and everything worked as...
24
by: jonathon | last post by:
Hi all, I have a web app with a popup window for entering data. I don't want to access the web every time this window is opened, as most of the app is AJAX. But I can't figure out how to open...
2
by: Anand Sagar | last post by:
I have a Panel1 and button1 on my webform. At runtime, I create 2 textboxes. I do it at the Page_Load event. I put the code within the " If Not isPostBack" For the button click event, I will do...
9
by: kermit | last post by:
I keep seeing that you can use the FileSystemObject in either VB script, or Javascript on an aspx page. I added a refrence to the scrrun.dll I added importing namespaces for 'System.Object',...
1
by: Paul Mars | last post by:
I am creating a user selectable quantity of buttons at run time and need to respond to their click events. My code: Dim btnButton as Button (global) Then in a sub: For intNumBtnsDown = 0...
2
by: epigram | last post by:
I'm dynamically creating a number of radio buttons on my aspx page based upon data read from a db. Each radio button has autopostback turned on. I'm experiencing two problems. 1) I am reading...
1
by: ganesh22 | last post by:
Hi, the below code is for to create dynamically buttons in asp.net. my problem is at the first time i visited the page its working but if i visited the second time that buttons is not clearing....
1
by: deepapanch | last post by:
Hi All: I am new to C#. Have created a simple outlook add-in, which adds a command bar in Outlook. On click of the button, I would like to load the a simple dialog with a Text Box and a...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.