Results 1 to 4 of 4

Thread: The following causes a crash, know why?

  1. #1

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245
    Why does this cause a crash once I try to minimize the the app? The line in parentheses is the offender...but I need it to be set to this size becuase of where the cmdbuttons are for when the window state is 0 or 2.

    Private Sub Form_Resize()
    'This is activated every time that you resize the form
    'either by controlbox or mouse resize
    'eg.
    txtNotepad.Width = Main.Width - 120
    ( txtNotepad.Height = Main.Height - 1150 )
    cmdOpen.Top = Main.Height - 1100
    cmdSave.Top = Main.Height - 1100
    cmdExit.Top = Main.Height - 1100
    End Sub

    Daniel Christie

  2. #2

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245

    Ah ha!...I got it, here is the results.

    I believe I fixed it...well it works.
    Do you think this is proper coding?

    Private Sub Form_Resize()
    'This is activated every time that you resize the form
    'either by controlbox or mouse resize
    'eg.
    If Main.WindowState = 1 Then
    GoTo Bottom
    End If

    txtNotepad.Width = Main.Width - 120
    txtNotepad.Height = Main.Height - 1150
    cmdOpen.Top = Main.Height - 1100
    cmdSave.Top = Main.Height - 1100
    cmdExit.Top = Main.Height - 1100
    Bottom:
    End Sub

    Daniel Christie

  3. #3
    Addicted Member
    Join Date
    Jul 2000
    Location
    California
    Posts
    154
    Instead of useing the Goto statement you could have put all
    the code inside the IF Then statement.


    Like this


    If Main.WindowState = 1 Then

    txtNotepad.Width = Main.Width - 120
    txtNotepad.Height = Main.Height - 1150
    cmdOpen.Top = Main.Height - 1100
    cmdSave.Top = Main.Height - 1100
    cmdExit.Top = Main.Height - 1100

    End If

    End





    In this case there isn't enough code to make a big difference but if you have a lot of code and some goto statements
    it would be a lot of work to figure the code out.

  4. #4

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245

    This is true, good suggestion.

    I appreciate your keen suggestion, thankyou,
    Daniel Christie

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