none
Form Qustion... RRS feed

  • Question

  • How can I put several different scenes in a form? Each of them creates a form and sets the screen differently, so I'm asking you a question. EX) Windows 10 Setup Program (inserting multiple screens in a form) (I think the screen will not make sense, so I'll leave a picture!)
    Wednesday, May 23, 2018 7:39 AM

All replies

  • I guess there is something lost in translation "What do you mean with a scene?"

    However, after long thinking, maybe a MDI client. 

    https://docs.microsoft.com/en-us/dotnet/framework/winforms/advanced/how-to-create-mdi-child-forms


    Success
    Cor

    Wednesday, May 23, 2018 7:45 AM
  • How can I put several different scenes in a form?
    The usual way to do this is to have multiple Panel controls in the form, include each 'scene' in its own panel, and show the panel for the scene you currently want displayed, hiding each of the others.  There are many other options, but without more details of what you are trying to achieve it is difficult to be specific.
    Wednesday, May 23, 2018 7:47 AM
  • Is this what you want to do?

    The list box has the names of the forms and then launches the form when clicked. So its a menu to select the forms it can be anything to select the form.

    Public Class Form1
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            ListBox1.Items.Add("Form2")
            ListBox1.Items.Add("Form3")
    
        End Sub
    
    
        Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
            Dim objType As Type = Type.[GetType]("test1." & ListBox1.Items(ListBox1.SelectedIndex).ToString)
            Dim objForm As Control = DirectCast(Activator.CreateInstance(objType), Control)
    
            objForm.Show()
    
        End Sub
    End Class

    Wednesday, May 23, 2018 8:05 AM
  • Hello,

    Check out the following post which shows how to create a wizard style control which has full source code. 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, May 23, 2018 9:15 AM
    Moderator
  • I suspect that "Wizard" is the terminology you are looking for, as Karen has pointed out. 

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Wednesday, May 23, 2018 11:25 AM
    Moderator
  • You could do something simple like loading a List(Of Bitmap) with the picture scenes you want. Then display them in the order loaded in a PictureBox using Buttons to move forward or backward through the scenes.

    The issue will be loading the images in order of scenes.

    Option Strict On
    
    Public Class Form1
    
        Dim BitmapList As New List(Of Bitmap)
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Me.Location = New Point(CInt((Screen.PrimaryScreen.WorkingArea.Width / 2) - (Me.Width / 2)), CInt((Screen.PrimaryScreen.WorkingArea.Height / 2) - (Me.Height / 2)))
            For Each Item In IO.Directory.GetFiles("C:\Users\John\Desktop\Images")
                BitmapList.Add(CType(Image.FromFile(Item), Bitmap))
            Next
            PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
        End Sub
    
        Dim Index As Integer = -1
    
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Index += 1
            If Index = BitmapList.Count Then Index = 0
            PictureBox1.Image = BitmapList(Index)
        End Sub
    
        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            Index -= 1
            If Index = -1 Then Index = BitmapList.Count - 1
            PictureBox1.Image = BitmapList(Index)
        End Sub
    
    End Class
    


    La vida loca

    Saturday, May 26, 2018 10:41 PM