Results 1 to 8 of 8

Thread: making different forms show?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2004
    Posts
    27

    making different forms show?

    Hi i would like a form on my programe with a button on it, when the users clicks the button it will take them to another form, any idea of how i could do this? or maybe even add a password protected form?

    Regards

    Homer

  2. #2
    New Member
    Join Date
    Apr 2004
    Location
    central florida
    Posts
    4

    Lightbulb

    the other form will show when you call it as:

    '**** Call the 2nd form ****
    Dim mdiForm2 As Form2 'class: define the form2

    mdiForm2 = New Form2

    mdiForm2.ShowDialog() 'call MDI window as modal

    or
    mdiForm2.Show() 'call MDI window as normal

    you must first build your 2nd form as a class.
    Public Class Form2
    Inherits System.Windows.Forms.Form
    ......
    vb .Net ,CW5, Sybase, Crystal Reports.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2004
    Posts
    27
    build the form as a class?

    can't i just insert a new form and make it visible=false so when the button is clicked this enables it?

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Everything is a class in .NET includ8ing forms.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5
    New Member
    Join Date
    Apr 2004
    Location
    central florida
    Posts
    4
    you will have to try that...

    Let me know if that works, tho.

    vb .Net ,CW5, Sybase, Crystal Reports.

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Err. no it wont work. You have to instantiate the form.

    There is no such thing as 'inserting a form'
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  7. #7
    New Member
    Join Date
    Apr 2004
    Location
    central florida
    Posts
    4
    you will have to try that...

    Let me know if that works, tho.

    vb .Net ,CW5, Sybase, Crystal Reports.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    May 2004
    Posts
    27
    hi now created a new form called Form2.vb ive put a button on here and this is the code ive putt on it

    Dim Form2 As New Form2()
    Form1.Show()
    Me.Hide()
    Form2.Hide()

    its seems to be having a problem with Form1.Show()

    "Reference to a non-shared member requires an object reference"

    anyone know why?

    thanks

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