(Msg. 1) Posted: Thu Jun 26, 2008 1:09 am
Post subject: Filling Dynamically Created Textboxes Add to elertz Archived from groups: microsoft>public>word>vba>userforms (more info?)
Hello everybody,
I was lucky enough to find a way to create Textboxes on a form at
runtime: (The Textboxes are in a frame called: fr_Velden)
int_CTop = 10
For y = 1 To (N * 2)
Set nwControl = Me.fr_Velden.Controls.Add("Forms.TextBox.1",
"TextBox" & y)
nwControl.Visible = True
nwControl.Height = 24 ' Twips
nwControl.Top = int_CTop
If y Mod 2 = 0 Then
int_CTop = int_CTop + 25
nwControl.Width = 215
nwControl.Left = 60
Else
nwControl.Width = 50
nwControl.Left = 5
End If
Next y
..fr_Velden.ScrollHeight = int_CTop + 10
However, I have no idea how to fill those Textboxes at runtime.
Can anybody tell me how to fill thems, or any other control created at
runtime?
Thanks a lot in advance.
Hans
(Msg. 2) Posted: Thu Jun 26, 2008 3:04 am
Post subject: Re: Filling Dynamically Created Textboxes Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
nwControl.Text = "some text"
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
<Sunouchi@> wrote in message
news:eej564553huphe539638sguni2s6sgcoha@4ax.com...
> Hello everybody,
> I was lucky enough to find a way to create Textboxes on a form at
> runtime: (The Textboxes are in a frame called: fr_Velden)
>
> int_CTop = 10
> For y = 1 To (N * 2)
> Set nwControl = Me.fr_Velden.Controls.Add("Forms.TextBox.1",
> "TextBox" & y)
> nwControl.Visible = True
> nwControl.Height = 24 ' Twips
> nwControl.Top = int_CTop
> If y Mod 2 = 0 Then
> int_CTop = int_CTop + 25
> nwControl.Width = 215
> nwControl.Left = 60
> Else
> nwControl.Width = 50
> nwControl.Left = 5
> End If
> Next y
> .fr_Velden.ScrollHeight = int_CTop + 10
>
>
> However, I have no idea how to fill those Textboxes at runtime.
> Can anybody tell me how to fill thems, or any other control created at
> runtime?
> Thanks a lot in advance.
> Hans
(Msg. 3) Posted: Thu Jun 26, 2008 5:05 pm
Post subject: Re: Filling Dynamically Created Textboxes Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
I know the nwControl.Text but that solution is not in the pop-up list
that you get after you type the dot, so I didn't try. I should have
done it.
Perhaps your solution works better, but by trying I found another
solution which works fine as well:
(Msg. 4) Posted: Thu Jun 26, 2008 6:36 pm
Post subject: Re: Filling Dynamically Created Textboxes Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
You should be careful with using default properties like:
True, the default property of a textbox (.Value) will take a string like
"some text".
However, if nwControl was NOT a TextBox, then it may not accept a string.
It is better to use explicit properties, like nwControl.Text
Sunouchi@ wrote:
>I know the nwControl.Text but that solution is not in the pop-up list
>that you get after you type the dot, so I didn't try. I should have
>done it.
>
>Perhaps your solution works better, but by trying I found another
>solution which works fine as well:
>
>Me.fr_Velden.Controls(nwControl.Name) = "some text"
>
>So both are good solutions, though I have no idea why my solution
>works as well.
>
>Thanks a lot.
>
>>nwControl.Text = "some text"
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum