ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   getting textbox value (https://www.excelbanter.com/excel-programming/294541-getting-textbox-value.html)

monika

getting textbox value
 
Hi

I am tryign to add dynamic textbox (I am successful...with
the feedback i got from this superb usergrp).
But i am unable to check for its value...i have done a lot
of modification with the code below.. its gives an error
at:
For Each newButton In Me.Controls

any help?
thanks...

Public newButton As MSForms.Control
Private Sub UserForm_Initialize()

numOfSheets = 4
z = 18
If numOfSheets 4 Then frmAddMoreSheets.Height = 300
For i = 1 To numOfSheets
Set newButton = Me.Controls.Add
("Forms.Textbox.1", "txtBox")
newButton.Name = "Textbox" & i
z = z + 30
With newButton
.Left = 18
.Top = z
.Visible = True
End With

Next i
'Unload Me
End Sub
Private Sub CommandButton1_Click()
For i = 1 To numOfSheets
'If TextBox & i.Value = "" Then MsgBox "emptu"
Next i
For Each newButton In Me.Controls
With newButton

If .Value = "" Then MsgBox "empty"
End With
Next newButton

End Sub



No Name

getting textbox value
 
I resolved this...as I found a wonderful article on
dynamic forms. Though Bob had given a lead in my
yesterday's post... but this one actually shows you how to
refer the value's.

http://pubs.logicalexpressions.com/P...PMArticle.asp?
ID=259
-----Original Message-----
Hi

I am tryign to add dynamic textbox (I am

successful...with
the feedback i got from this superb usergrp).
But i am unable to check for its value...i have done a

lot
of modification with the code below.. its gives an error
at:
For Each newButton In Me.Controls

any help?
thanks...

Public newButton As MSForms.Control
Private Sub UserForm_Initialize()

numOfSheets = 4
z = 18
If numOfSheets 4 Then frmAddMoreSheets.Height = 300
For i = 1 To numOfSheets
Set newButton = Me.Controls.Add
("Forms.Textbox.1", "txtBox")
newButton.Name = "Textbox" & i
z = z + 30
With newButton
.Left = 18
.Top = z
.Visible = True
End With

Next i
'Unload Me
End Sub
Private Sub CommandButton1_Click()
For i = 1 To numOfSheets
'If TextBox & i.Value = "" Then MsgBox "emptu"
Next i
For Each newButton In Me.Controls
With newButton

If .Value = "" Then MsgBox "empty"
End With
Next newButton

End Sub


.



All times are GMT +1. The time now is 07:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com