Results 1 to 9 of 9

Thread: Help - What form do i use for my programming? Noob here...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Posts
    232

    Help - What form do i use for my programming? Noob here...

    Hi all, need some advice for my project work. Before that i will just give a brief description on my project.

    Well currently I am asked to do out a program which is a replenish system aka. an inventory system which will do out MRP (material resources planning), ERP etc etc. Some of which calculations and charts will need to be present.

    Right now I have a question which is that if i use a standard exe form, is it possible to do out this inventory system programming or will i have to use other forms and templates to do it?

    (by the way, I have just started learning visual basic around 4 days ago)

    Please do advise, thank you and hope to hear help soon!

    Thank you.

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Help - What form do i use for my programming? Noob here...

    You would create a Standard EXE project in Visual Basic.

    And you would probably want to use pre-built controls for displaying charts & graphs. In VB, press CTRL+T to open the Components Dialog and look for the controls like Microsoft Chart Control, Graph Control, (I forget what it's called), and try messing with other ones in there that you might need...

    You will probably want to add at least:

    Microsoft Common Dialog Control - for showing open/save file dialogs

    Microsoft Common Controls (either 5.0 or 6.0, 6.0 has less bugs) - contains common controls like ListView, StatusBar, TreeView, etc.

    Some sort of chart/graph control

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Posts
    232

    Re: Help - What form do i use for my programming? Noob here...

    I see. Thanks alot DigiRev. Can I ask you something else?

    Supposedly, right now I have input data into form1, for example and I would like the data to appear in form2 again by using a 'Continue' button created in form1, is it possible?

    Or do i need to do up some linkings?

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Help - What form do i use for my programming? Noob here...

    Yes you can. Simply .Show the form from the button click and hide your first form.


    Code:
    Private Sub Command1_Click()
        Form2.Show
        Form1.Hide
    end Sub
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  5. #5
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Help - What form do i use for my programming? Noob here...

    Not sure if you just meant showing the forms like RobDog said, or passing data between forms.

    You can pass data between forms by putting: FormName.TextBox.Text = "Something".

    However, if you want to maintain data between multiple forms, you are best off using public variables within a module, example:

    vb Code:
    1. 'Module1.bas
    2. Option Explicit
    3.  
    4. Public strName As String

    Then from any of your forms or other modules, you can just set/read from strName.

    If you want to store a bunch of different values that are all related to each other, then you may want to use a UDT, or User-Defined Type. For example, if you are creating a "Wizard"-type of program, with multiple steps, you can organize the variables better by putting them all into one type. Example:

    vb Code:
    1. 'Module1.bas
    2. Option Explicit
    3.  
    4. Public Type WIZARD_DATA
    5.     strFirstName As String
    6.     strLastName As String
    7.     strPhoneNumber As String
    8.     strEmail As String
    9.     'etc...
    10. End Type
    11.  
    12. Public udtWizard As WIZARD_DATA

    Now, from your forms, you can just use the single udtWizard data like:

    vb Code:
    1. With udtWizard
    2.     .strFirstName = txtFirstName.Text
    3.     .strLastName = txtLastName.Text
    4.     'etc...
    5. End With

    And all of your forms/modules will be able to access udtWizard...this is usually more organized than a bunch of different variables declared in a module.

  6. #6
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: Help - What form do i use for my programming? Noob here...

    Moment please RobDog888. I don't want to say this, but why would you want to "Form1.Hide". When you can unload all of the variables, controls and all of the data from execution and in doing this. You can use the following line of code. "Unload Form1".

    I guess that unloading the Forms, that you don't need in memory is a better way of programming. Because that frees enough memory for the system to use for the project and other items running in the background.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Posts
    232

    Re: Help - What form do i use for my programming? Noob here...

    Hi ThEiMp, you say 'unload form1', does that mean all the data input I have put in form one will be cleared?

    Because right now, as stated in my first post I had like to have the datas I put in form 1 and have it appeared in form 2 as well when I clicked the 'Continue' button present in form 1...

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Help - What form do i use for my programming? Noob here...

    If I were doing this, I would do all the input on one form, that had multiple frames with controls in them (a wizard, basically) with Next and Back buttons.

    Once the last frame was displayed, and Finished was clicked (or whatever you wanted to call the button indicating the data input was done, then you could take the information from all the controls and display them either one a new frame on Form1, or a set of controls on Form2.

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Help - What form do i use for my programming? Noob here...

    Yes, if you unload a form then all objects are cleared from memory and the data that was populated by the user.

    I used to use the switching in/out of frames but its a bit cumbersom to work with. I would use separate forms but each step writting out to a temp file or temp table the data that is input on each form. Then if htey need to go back you can just hide/show the appropriate form without needing to reload it. Only if they change any data then you rewrite that part to the file/table.
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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
  •  



Click Here to Expand Forum to Full Width