WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Filling Dynamically Created Textboxes

 
   Home -> Office -> User Forms RSS
Next:  User Forms: No Events for Dynamically Created Checkboxes?  
Author Message
Sunouchi

External


Since: Jun 26, 2008
Posts: 5



(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
Back to top
Login to vote
Doug Robbins - Word MVP

External


Since: Jul 14, 2006
Posts: 4753



(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
Back to top
Login to vote
Sunouchi

External


Since: Jun 26, 2008
Posts: 5



(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:

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.

On Thu, 26 Jun 2008 12:08:30 +1000, "Doug Robbins - Word MVP"
<dkr.RemoveThis@REMOVECAPSmvps.org> wrote:

>nwControl.Text = "some text"
Back to top
Login to vote
fumei via OfficeKB.com

External


Since: Sep 21, 2007
Posts: 24



(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:

Me.fr_Velden.Controls(nwControl.Name) = "some text"

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"

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200806/1
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> User Forms 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
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET