Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 136,459 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,790 people online right now. Registration is fast and FREE... Join Now!




binding text box at runtime

 
Reply to this topicStart new topic

binding text box at runtime

joe_1980
12 Aug, 2008 - 01:42 AM
Post #1

New D.I.C Head
*

Joined: 12 Aug, 2008
Posts: 1

hi to everybody
i need to create textboxes at runtime as per the customer requirement and then concatenate all the texts of these generated textboxes into an existing textbox. here is my code

vb

Public Class frmSuggestion
Public Class MyTextBox
Inherits System.Windows.Forms.TextBox
End Class

Private Sub BtnNewSuggestion_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNewSuggestion.Click
Static num As Integer

num += 1
If num < 7 Then
ReDim TextBoxes(num)
TextBoxes(num - 1) = New MyTextBox()
With TextBoxes(num - 1)
.Name = "TxtNewSuggestion" & num
.Width = 238
.Height = 20
.Location = New System.Drawing.Point(56, (num * (.Height + 5) + 186))
End With

Me.TpAction.Controls.AddRange(New System.Windows.Forms.Control() {TextBoxes(num - 1)})

End If
End Sub
End Class


these code are working but i don't know how to collect the data in the generated textboxes and put it in suppose textbox1. if someone could help me please

Mod Edit: Please use code tags when posting your code. Code tags are used like so => code.gif

Thanks,
PsychoCoder smile.gif
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Binding Text Box At Runtime
14 Aug, 2008 - 12:25 PM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,993



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Moved to VB.NET
User is offlineProfile CardPM
+Quote Post

perfectly.insane
RE: Binding Text Box At Runtime
15 Aug, 2008 - 02:08 AM
Post #3

D.I.C Addict
Group Icon

Joined: 22 Mar, 2008
Posts: 558



Thanked: 46 times
Dream Kudos: 25
Expert In: C/C++

My Contributions
Did you try looking at the TextBoxes(0).Text property? Or for that matter, any index in that array? It won't be any different than normal text box access, as what you are doing is really the same as what the form designer does (it generates code to create your form). Reading the designer generated code is a good way to learn how something should be done with the forms in some cases.

This post has been edited by perfectly.insane: 15 Aug, 2008 - 02:10 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 04:10PM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month