Results 1 to 18 of 18

Thread: Question on Modules & Form Reuse

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2005
    Posts
    192

    Question on Modules & Form Reuse

    Been Tinkering with this question. I don't want to create another form because that would be a waste of space (not that it matters) but it wouldn't be the correct way to go about it.

    I am working on a function (I think?) and I want to tell a command button which form to show.

    So I need to modify what happens when the cmd_click() event is fired. I'm thinking writing, flow charting, and my head is hurting. I've tried coming up with some code but its not working.

    I really hope Modules are much easier than this. I haven't successfully been able to run a module (other than pre-canned [long] code)

    Should they really let a DJ/Webmaster use VB6?
    If I think VB6 is hard what about C++! Trust me been there, gave up after hello world.

  2. #2
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: Question on Modules & Form Reuse

    So all you need to do is show a certian form when a command button is clicked? Or do you want to create the form from scratch when the command button is clicked? Can you give us more info so we can help.
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2005
    Posts
    192

    Re: Question on Modules & Form Reuse

    User Clicks on an initial push button within that click is the code to tell the push button on another form that pops up what form to load

    Is that making sense?

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,427

    Re: Question on Modules & Form Reuse

    Attached is a form that has a multiple-purpose command button.

    As for C++ - been there, done that, can't get the smell out of my head.
    Attached Files Attached Files

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jun 2005
    Posts
    192

    Re: Question on Modules & Form Reuse

    Quote Originally Posted by MartinLiss
    As for C++ - been there, done that, can't get the smell out of my head.
    I'm hopping that's a bad smell. I remember being much more of a noobie than I am now. (Hard to picture eh). And I remember that if I clicked on a checkbox it had to be validated and pointers and oh my gosh I don't know what the heck I'm talking about but it seems like C++!

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jun 2005
    Posts
    192

    Re: Question on Modules & Form Reuse

    Marty. That could work but I want lets say in my code. Someone pushes modify contact. The SelectContact form would show.

    If I add a task, I need to select a contact for that task. Select Contact. What I need to do is either close / open a form and input a value on the new task screen so when I input it into mysql it works all fine and dandy and everything is referenced correctly.

    I want to show my office the beta by the end of the week, b/c we could really use this app. Nothing on the market (for free) like it in fact I haven't seen much of anything like it.

  7. #7

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jun 2005
    Posts
    192

    Re: Question on Modules & Form Reuse

    Let me attach screen shots to help. Give me a little bit.

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jun 2005
    Posts
    192

    Re: Question on Modules & Form Reuse

    here you go.

    On Main.JPG
    User clicks modify contact (Select.jpg) and select client pops up.

    On NewTask.JPG
    User CLicks the Select Contact (Blue arrow) and Select.JPG pops up.
    Attached Images Attached Images    

  10. #10
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,427

    Re: Question on Modules & Form Reuse

    When you say for example "User clicks modify contact (Select.jpg) and select client pops up", are you saying that that already happens and you want to change what happens, or that nothing happens now when you click modify contact and you want select client to pop up?

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Jun 2005
    Posts
    192

    Re: Question on Modules & Form Reuse

    > nothing happens now when you click modify contact and you want select client to pop up?
    No No No.. That code works fine.

    I want two different types of things to happen from that form, but different actions to be performed depending on where you click the command button to show Select.JPG (Select Contact)

    Senario 1:
    User Clicks it within New Task...

    what's to happen:
    Allows you to select a contact, and then return the value of the listview box. (Unload both forms on completion) The Unload part is not a problem.

    Senario 2:
    User Clicks Modify Contact of the Main Screen.

    What's to Happen:
    Select Contact Box appears. It will take you into a modify contact screen and have the values populated already.

    (Parts in Italics I can cover as soon as solution is solved, on my own time)

  12. #12
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Question on Modules & Form Reuse

    Maybe you coud use a variable that is an ActionFlag.

    VB Code:
    1. ActionFlag = "NewTask"
    2.  
    3. select case ActionFlag
    4. case "NewTask"
    5.   '  DO SOMETHING HERE
    6. case "ModifyTask"
    7.   '  DO SOMETHING ELSE HERE

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Jun 2005
    Posts
    192

    Re: Question on Modules & Form Reuse

    How would I Declare that. Publicly of course.

    I do like your code on the Action Flag. I WILL need to incorperate something like that. The title was of modules. So that was something I didn't think of. But Yeah, how would I declare the variable from the command button pressed. I would need a function to declare which action flag is being used correct?

  14. #14
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Question on Modules & Form Reuse

    If you declare ActionFlag in a module, you can set it and read it from anywhere.
    Just set it depending on what form is shown, or which button is pressed. You may need a few other choices, or even another flag. You might be able to set the .tag value of a form to show where the keypress came from

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Jun 2005
    Posts
    192

    Re: Question on Modules & Form Reuse

    That's another thing. I've never sucessfully been able to write to the tag property on runtime, You think it would be easy as formname.Tag but it won't write. This is after the form is set to show. so

    form.show
    formtag = "something"

    and it won't stick. I don't get why. Wierd stuff.

  16. #16

  17. #17
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Question on Modules & Form Reuse

    Almost all controls have a tag property. I use them for many things in one of my programs.

  18. #18
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,123

    Re: Question on Modules & Form Reuse

    I still couldnt get what you want after reading all the posts here.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

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