Results 1 to 16 of 16

Thread: How to get this working?

Threaded View

  1. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    The problem is simple...

    On your form... in your button click event.... you call Test()...

    Which then declares a new form, and disables/enables a button on the new form. By default, the new form's button is enabled, so it disables it.

    You see.. you have two forms here... one is instantatied by the IDE when you click RUN (Form1)... the other one is being declared and manipulated in your module1 Class. and that one has a problem though...you haven't set the frm.visible=true

    ------------------

    You should have this in your module:

    VB Code:
    1. Module Module1
    2.     Public Sub Main()
    3.         Dim frm As New Form1()
    4.         Application.Run(frm)
    5.  
    6.     End Sub
    7. End Module

    And this in your button1_click event:
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         If Button2.Enabled = False Then
    3.             Button2.Enabled = True
    4.         Else
    5.             Button2.Enabled = False
    6.         End If
    7.     End Sub
    And then right-click your project file in the solution explorer window, and set the startup object to Main().
    Last edited by nemaroller; Jul 1st, 2003 at 11:13 PM.

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