By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,852 Members | 955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,852 IT Pros & Developers. It's quick & easy.

Creating text boxes on the fly?

P: n/a
Hello everyone,
Please can anyone tell me if it is possible for a VB.NET application to
check a database and then create textboxes on a form that correspond to
those records on the database? For example, say I had a table in a DB that
contained movie subjects: Horror, Sci-Fi, Comedy etc. Would it be possile
for the VB app to look at these and then create the text boxes Horror,
Sci-Fi and Comedy?

Thanks,
BWT
Nov 11 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a

"BurntWithTime" <sa**@lastdream.comwrote in message
news:P-******************************@bt.com...
Hello everyone,
Please can anyone tell me if it is possible for a VB.NET application to
check a database and then create textboxes on a form that correspond to
those records on the database? For example, say I had a table in a DB that
contained movie subjects: Horror, Sci-Fi, Comedy etc. Would it be possile
for the VB app to look at these and then create the text boxes Horror,
Sci-Fi and Comedy?

Thanks,
BWT
Yes, you can. If you're wondering about the code, just create a simple VB
Windows app, place a textbox on the form, then have a look at the generated
code. In VS 2005, display all files, then look at <your form
name>.designer.vb
Nov 11 '06 #2

P: n/a
Peter,

In my idea you cannot do anymore what the OP is asking, in classic VB there
is I thought the name was a DataBaseProject or something like that, that
makes a complete form for you using the database. Now it is back in 2.0
with, however there it uses the datagridview and no textboxes.

http://www.vb-tips.com/dbpages.aspx?...2-b1ed16424252

I was asking myself why I had not answered this question and than felt the
quarter.

This is an often used phrase in Dutch. (Toen viel het kwartje) although the
quarter does not exist anymore in the Euro.

In fact he is in my opinion asking for Office MS Access

Cor
"pvdg42" <pv****@newsgroups.nospamschreef in bericht
news:ux*************@TK2MSFTNGP03.phx.gbl...
>
"BurntWithTime" <sa**@lastdream.comwrote in message
news:P-******************************@bt.com...
>Hello everyone,
Please can anyone tell me if it is possible for a VB.NET application to
check a database and then create textboxes on a form that correspond to
those records on the database? For example, say I had a table in a DB
that contained movie subjects: Horror, Sci-Fi, Comedy etc. Would it be
possile for the VB app to look at these and then create the text boxes
Horror, Sci-Fi and Comedy?

Thanks,
BWT
Yes, you can. If you're wondering about the code, just create a simple VB
Windows app, place a textbox on the form, then have a look at the
generated code. In VS 2005, display all files, then look at <your form
name>.designer.vb

Nov 11 '06 #3

P: n/a

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Peter,

In my idea you cannot do anymore what the OP is asking, in classic VB
there is I thought the name was a DataBaseProject or something like that,
that makes a complete form for you using the database. Now it is back in
2.0 with, however there it uses the datagridview and no textboxes.

http://www.vb-tips.com/dbpages.aspx?...2-b1ed16424252

I was asking myself why I had not answered this question and than felt the
quarter.

This is an often used phrase in Dutch. (Toen viel het kwartje) although
the quarter does not exist anymore in the Euro.

In fact he is in my opinion asking for Office MS Access

Cor
I thought he was asking if text boxes could be created in code, which they
can. The issue of where to obtain the data to populate the text property is
secondary. If the OP wants to write the code to create a textbox in a method
called based on some event occurring, then populate the text property of the
new textbox with data (or metadata) retrieved from a database, that's easily
done as well.

Of course, if what the OP is looking for is automatic form generation,
you're right.
Nov 11 '06 #4

P: n/a
Thanks for the replies people.
There seems to be some confusion. I do not want to create the entrie form
automatically, just create the text boxes automatically. So basically the
form is blank, but when it is loaded, the program checks the database, and
creates the text boxes that are needed. Does this make it any clearer?
"pvdg42" <pv****@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>Peter,

In my idea you cannot do anymore what the OP is asking, in classic VB
there is I thought the name was a DataBaseProject or something like that,
that makes a complete form for you using the database. Now it is back in
2.0 with, however there it uses the datagridview and no textboxes.

http://www.vb-tips.com/dbpages.aspx?...2-b1ed16424252

I was asking myself why I had not answered this question and than felt
the quarter.

This is an often used phrase in Dutch. (Toen viel het kwartje) although
the quarter does not exist anymore in the Euro.

In fact he is in my opinion asking for Office MS Access

Cor
I thought he was asking if text boxes could be created in code, which they
can. The issue of where to obtain the data to populate the text property
is secondary. If the OP wants to write the code to create a textbox in a
method called based on some event occurring, then populate the text
property of the new textbox with data (or metadata) retrieved from a
database, that's easily done as well.

Of course, if what the OP is looking for is automatic form generation,
you're right.

Nov 11 '06 #5

P: n/a

"BurntWithTime" <sa**@lastdream.comwrote in message
news:qO******************************@bt.com...
Thanks for the replies people.
There seems to be some confusion. I do not want to create the entrie form
automatically, just create the text boxes automatically. So basically the
form is blank, but when it is loaded, the program checks the database, and
creates the text boxes that are needed. Does this make it any clearer?

As I answered originally, yes, you can create the textboxes you need
programmatically (IOW, your program will create the needed controls after
querying the database to see what is needed).

My first response told you where to find example code for control creation,
if you need something more explicit, ask away.

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
Nov 12 '06 #6

P: n/a
Burnt,
>So basically the form is blank, but when it is loaded, the program checks
the database, and creates the text boxes that are needed. Does this make it
any clearer?
In my idea not, in my idea is Peter answering you exactly how you creates
text boxes on the fly.

However, although it is in your subject is in my idea in your text not what
at least in these newsgroups is called "creating text boxes on the fly".

Or you should make yourself a program as Peter wrotes, that checks the
content of the datatables and make as many textboxes as there are
datacolumns in your dataset.

Something as

\\\
For each dc as datacolum in myDataTable.DataColumns
dim txtBox as new Textbox
txtBox.Name is dc.ColumName
'set the position and other probertis of that textbox
Controls.Add(txtBox)
Next
///

Than you have what you ask.

With that hoping to end at least my confusion.

Cor

"BurntWithTime" <sa**@lastdream.comschreef in bericht
news:qO******************************@bt.com...
Thanks for the replies people.
There seems to be some confusion. I do not want to create the entrie form
automatically, just create the text boxes automatically. So basically the
form is blank, but when it is loaded, the program checks the database, and
creates the text boxes that are needed. Does this make it any clearer?
"pvdg42" <pv****@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>Peter,

In my idea you cannot do anymore what the OP is asking, in classic VB
there is I thought the name was a DataBaseProject or something like
that, that makes a complete form for you using the database. Now it is
back in 2.0 with, however there it uses the datagridview and no
textboxes.

http://www.vb-tips.com/dbpages.aspx?...2-b1ed16424252

I was asking myself why I had not answered this question and than felt
the quarter.

This is an often used phrase in Dutch. (Toen viel het kwartje) although
the quarter does not exist anymore in the Euro.

In fact he is in my opinion asking for Office MS Access

Cor
I thought he was asking if text boxes could be created in code, which
they can. The issue of where to obtain the data to populate the text
property is secondary. If the OP wants to write the code to create a
textbox in a method called based on some event occurring, then populate
the text property of the new textbox with data (or metadata) retrieved
from a database, that's easily done as well.

Of course, if what the OP is looking for is automatic form generation,
you're right.


Nov 12 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.