INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

automation of copying Data from one form to another in VB .net

automation of copying Data from one form to another in VB .net

(OP)
Good evening all,
First off I have not programmed in over 20 years so this is a steep learning curve for me.

I have multiple forms with the first nine fields are identical. I am wanting to copy those Nine fields to each form as it is called.

I call these forms by a combobox using an if statement and I am wanting to make my code neat and short and not long winded.
As you can expect having 10 - 11 options within a ComboBox to call that many forms and then copy the data over.

So far I have searched google and not found anything helpful as I think I am looking in the wrong way.
Please don't treat me like an idiot as other forms have.. ta

If you need a copy of my code so far I can supply.

RE: automation of copying Data from one form to another in VB .net

(OP)
Ok worked out a different way.
I create a Public Sub and put in the nine fields I want to copy to all forms and then call when needed....

Now why did I not think of that in the first place. :(

RE: automation of copying Data from one form to another in VB .net

So you are going to have 10 or 11 Forms, 9 fields will be the same on all Forms. I assume user can see only one form at the time (is that correct?)

If so, I would create just 1 Form with the 9 fields, and create 10 or 11 frames / group boxes / tab control / whatever on this one Form and display one at the time depending on what user wants to see.

"I call these forms [frames / group boxes] by a combobox using an if [select case] statement and I am wanting to make my code neat and short and not long winded."
That will do it, in my opinion. smile

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: automation of copying Data from one form to another in VB .net

(OP)
Andrzejek - That is such an awesome idea, I did not think of that... Thank you very much..

RE: automation of copying Data from one form to another in VB .net

I've used the option suggested by Andrzejek many times in the past. However I normally use that for just a few common controls. When a lot of common controls are involved I tend to create a new form containing just those controls and subsequently inherit from it and add any additional controls to the inherited form.

RE: automation of copying Data from one form to another in VB .net

Sorry, I omitted mentioning that when there is data that needs to be copied in the way you require, I tend to create a class with properties to hold the data and therefore quickly and easily load it into each relevant control. The controls can be populated on each individual form's load event.

RE: automation of copying Data from one form to another in VB .net

I am glad you like my idea smile
Others - like softhemc - do this more 'sophisticated' way, but I am just a simple guy...

And as far as your other comment:
"Please don't treat me like an idiot as other forms have.. ta"
Here on TT nobody does it to others (unless you really, really ask for it )

Welcome to Tek-Tips wavey3

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: automation of copying Data from one form to another in VB .net

Welcome to Tek-Tips.

Quote:

Please don't treat me like an idiot as other forms have.. ta

That is something we don't want here@Tek-Tips. I can remember when I was ignorant of the stuff I know now. That stuff came by way of lots of people more knowledgeable that I, and for that I am grateful.

I know that there are also lots of contributing members who feel the same way. We all work to keep it that way and make it better.

So we hope you'll stick around, learn lots of good stuff and contribute as you are able and willing.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: automation of copying Data from one form to another in VB .net

I didn't notice the "Please don't treat me like an idiot as other forms have.. ta" line initially.

I agree with both Andrzejek and SkipVought and would also draw you attention to the two links at the bottom right of each post. The first is self explanatory, but the second is there to enable you report anything "unpleasant".

By the way, if you post your sample code, we could see what might be possible with regard to making it a bit neater.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close