Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default How to create new textboxes during runtime?When user clicks on a button textbox shouls appear.

Can any body help me with the code used to dynamically create textboxes
during run time .
I am having 2 textboxes Name and Phone number , Aligned side by side.
Now if user wants to add another person's contact details he will click
on button with caption "+" .I want that when he clicks on this button
two textboxes Name and Phone number shouls appear below the previous
Name and Phone Number text box.
III'ly if he wants to add one more person's name and contact he will
again click on the "+" button and then again 2 new text boxes should
appear below the 2nd person's text boxes.

Kindly help me with how to give the position of the textboxes to be
created during run time,how to make them and later how to access the
values of these dynamically created textboxes .

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default How to create new textboxes during runtime?When user clicks on a button textbox shouls appear.

I would do it as follows:

'============================
'frm: The User Form to add the TextBox to
'name: the name assigned to the TextBox
'x: Position from left edge in pixels
'y: Position from top edge in pixels

Public Sub addTextBox(ByVal frm As UserForm, ByVal name As String,
ByVal x As Integer, ByVal y As Integer) As MSForms.TextBox

Dim txt As MSForms.TextBox

Set txt = frm.Controls.Add("Forms.TextBox.1", name, True)

With txt
.Top = y
.Left = x
End With

End Sub
'============================

If you call this sub like so:

addTextBox(UserForm1, "MyTextBox", 10, 20)

....you will be able to extract values as follows:

UserForm1.Controls("MyTextBox").Text

Let me know if that meets your needs.

Regards,
Steve

divya schrieb:

Can any body help me with the code used to dynamically create textboxes
during run time .
I am having 2 textboxes Name and Phone number , Aligned side by side.
Now if user wants to add another person's contact details he will click
on button with caption "+" .I want that when he clicks on this button
two textboxes Name and Phone number shouls appear below the previous
Name and Phone Number text box.
III'ly if he wants to add one more person's name and contact he will
again click on the "+" button and then again 2 new text boxes should
appear below the 2nd person's text boxes.

Kindly help me with how to give the position of the textboxes to be
created during run time,how to make them and later how to access the
values of these dynamically created textboxes .


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default How to create new textboxes during runtime?When user clicks on a button textbox shouls appear.

Do you need to create the textbox during runtime? Could you create them, the
use the visible property when needed?

Craig

"divya" wrote in message
oups.com...
Can any body help me with the code used to dynamically create textboxes
during run time .
I am having 2 textboxes Name and Phone number , Aligned side by side.
Now if user wants to add another person's contact details he will click
on button with caption "+" .I want that when he clicks on this button
two textboxes Name and Phone number shouls appear below the previous
Name and Phone Number text box.
III'ly if he wants to add one more person's name and contact he will
again click on the "+" button and then again 2 new text boxes should
appear below the 2nd person's text boxes.

Kindly help me with how to give the position of the textboxes to be
created during run time,how to make them and later how to access the
values of these dynamically created textboxes .



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
EXCEL: put_DisplayAlerts fails if user is entering data and clicks toolbar button [email protected] Excel Programming 0 January 8th 06 08:05 AM
Button clicks and textbox Exit events Linc Excel Programming 3 December 26th 05 11:23 PM
Open an Outlook folder when a user clicks on a command button ... Rob Keel Excel Discussion (Misc queries) 2 August 1st 05 08:23 AM
Open an Outlook folder when a user clicks on a command button ... Rob Keel Excel Programming 2 August 1st 05 08:23 AM
How to create a URL and when user clicks it to open a Excel workbook Belinda Excel Programming 2 May 30th 04 01:06 PM


All times are GMT +1. The time now is 02:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"