|
-
Jul 29th, 2007, 03:46 AM
#1
Thread Starter
Addicted Member
[2005] Form Status...
Dear All,
Can anyone tell me how can I run a function or a sub from one form to another?
Let say I have a form that allow the user to enter information of an employee, (first, Last name, Add, and Department name etc…) the department name is a Combo box, that contain all the names of Department, if the user want to add new department he can press a button which load the Department form (different form). What I want is, when the user enters the new department and the User info form is loading, I want the Department list (combo box) in the (user form) to refresh and get the new list name of Department. “How can I do it?” I hope that I made it clear…
Appreciate any help…
Regards,
=======================================
If I helped you, Kindly Rate my post. Thanks
-----------
PHENOM 
-
Jul 29th, 2007, 03:52 AM
#2
Re: [2005] Form Status...
That's what data binding is for. You might have your Departments in a List(Of Department). You bind that List to your ComboBox. When you open the Departments dialogue and add a new Department you add it to that same List. You then call ResetBindings on the BindingSource and it will refresh the items displayed in the ComboBox from the List. It's this sort of thing that makes data-binding incredibly useful, despite some people's determination that it is inherently wrong (not you, someone else).
-
Jul 29th, 2007, 03:53 AM
#3
Re: [2005] Form Status...
You can transer data between two forms by creating some properties on your first form so the second form can read and set it as needed. Then in your first form, when the second closes from being displayed with .ShowDialog, you can refresh the dataset that should be bound to your combo and read the forms property to see what was set from the popup form.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|