Results 1 to 9 of 9

Thread: Back to previus form

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    131

    Back to previus form

    i need to add a command which will take me back to the previous step in my project

    in case of user wants to change some info in the first form to process it in the second form

    how can i run the script which is in (form-load ) again
    i.e how can i reload the second form as the first time

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Back to previus form

    VB Code:
    1. Private Sub Command1_Click()
    2.     yourForm.[B]Form_Load[/B]
    3. End Sub
    Bear in mind that this will work only if you'll change that Form_Load event to Public.

  3. #3

  4. #4
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    Jar, Norway
    Posts
    372

    Re: Back to previus form

    Remember that all variables connected to a form is emptied when form unloads.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    131

    Re: Back to previus form

    if this was the form_load code in the form1 form where the back button in
    and i returned to the main form


    VB Code:
    1. Private Sub Form_Load()
    2. RichTextBox1.Text = Main.txtFileText.Text
    3.  
    4.  With RichTextBox1
    5.         .SelStart = 0
    6.         .SelLength = Len(.Text)
    7.         .SelAlignment = 1
    8.  End With
    9.  
    10. Dim Result As Long
    11.  
    12. '// Set initial direction RTL
    13.  
    14. SetParaDirection (PFE_RTLPAR)
    15.  
    16. '// Set data structure arguments
    17.  
    18. vbBO.cbSize = LenB(vbBO) 'Size
    19.  
    20. vbBO.wMask = BOM_DEFPARADIR 'Attribute to set
    21.  
    22. vbBO.wEffects = BOE_RTLDIR 'Default direction
    23.  
    24. '// Set default direction RTL
    25.  
    26. Result = SendBOMessage(RichTextBox1.hwnd, EM_SETBIDIOPTIONS, 0, vbBO)
    27.  
    28. '// Adjust RightMargin of RichTextBox control
    29.  
    30. RichTextBox1.RightMargin = 9300
    31.  
    32.   With RichTextBox1
    33.         .SelStart = 0
    34.         .SelLength = 0
    35.      End With
    36.      
    37.    
    38.     If Main.Option2.Value = True Then
    39.           translate    'function
    40.     Else
    41.           GetData     'function
    42.     End If
    43.  
    44.   RichTextBox2.Text = Main.txtFileText.Text
    45.  
    46. End Sub



    should i just copy this code to a Module
    what about the functions calls, how they will be defined?

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

    Re: Back to previus form

    The function calls will work just fine as long as they are Public Sub or Public Function. However the references to the controls on the form will need to be modified. For example

    With Form1.RichTextBox1

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    131

    Re: Back to previus form

    do you mean that i have to copy the functions from form1 to a module?

  8. #8

  9. #9

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