Need equivalant code in VB.Net 2005 ?

L

Luqman

In VB-6, I have put my field names in DataField Property of Textbox for Tag
Purpose.

In code, I use it as under:-

for each control in me.controls
if typeof control is textbox then
myrecordset.fields(control.datafield).value=control.text
endif
next

How can I use above code or similar in Vb.Net ?

Best Regards,

Luqman
 
C

CMM

My first guess is to inherit from the textbox and add your "datafield" to
it. Add a textbox to your form. Go into generated code (this differs between
2002 and 2005) and change "...As Textbox" to "...As MyTextBox." Voila.

Similar to your predicament, I missed the Tag property in Menus when I
started using VB.NET... luckily its easy to extend the functionality of any
control in .NET.
 
A

Al Reid

If you are not using the Tag property for anything else, use it to hold the field name. Also, as already mentioned, it's east to
extend the controls to add field name and table name, etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top