Opens a page in the panel

0
1

I ‘m creating a menu and want to create code that can open panels on a page, previously I could create a menu on a form, here’s the code

 

Imports System

Imports Wisej.Web

Public Class Menu

Private Sub Menu_Load(sender As Object, e As EventArgs) Handles MyBase.Load
switchPanel(New Dashboard())
End Sub

Sub switchPanel(ByVal panel As Form)
Panel3.Controls.Clear()
panel.TopLevel = False
Panel3.Controls.Add(panel)
panel.Show()
End Sub

Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
Dim dashboard As New Dashboard()
switchPanel(dashboard)
End Sub

Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
Dim setting As New Setting()
switchPanel(setting)
End Sub

End Class

 

How do I change it, so that I can open panels On pages, And can change pages on panels?

  • You must to post comments
0
0

I’m a bit confused as to what exactly you are asking.
By “panel” do you mean a Wisej.Web.Panel? https://docs.wisej.com/api/wisej.web/containers/wisej.web.panel
Your code uses a Form (The parameter in Sub switchPanel(ByVal panel As Form) is of type Form) as in a Wisej.Web.Form https://docs.wisej.com/api/wisej.web/containers/form
Also, I’m unsure what Dashboard is – it seems to be a custom class that you created? Is it derived from Panel, Form, or something else?
By “page”, do you mean a Wisej.Web. Page? https://docs.wisej.com/api/wisej.web/containers/wisej.web.page

How do I change it, so that I can open panels On pages

So if you want to open panels instead of Forms, just use a Panel instead of a Form. If you want to open a Panel on a Page, first create a Page, and then create a Panel. If you use the template “Wisej.NET Web Page Application” for VB.NET, it will create a Page for you (Application.MainPage = new Page1() ), and then you can simply add the code to create a Panel, which can easily be done by dragging in a Panel from the toolbox in the Designer.
Code to create a panel:
Me.Panel1 = New Wisej.Web.Panel()
Me.Controls.Add(Me.Panel1)

And can change pages on panels?

To change pages/open a new Page, you can do this:
Application.MainPage = new Page1()
replace Page1 with the name of whatever page you want to show.

If you want some examples of how to create a menu in Wisej, look at the demobrowser: https://wisej-demobrowser.azurewebsites.net/
Specifically, you may want to look into the MenuBar: https://wisej-demobrowser.azurewebsites.net/#Tools%20and%20Menus/MenuBar/Features
And the Panel: https://wisej-demobrowser.azurewebsites.net/#Containers/Panel/Features

I have attached a simple example in VB.NET with 2 pages and 2 panels. Each Page contains a panel, and each panel contains a button that lets you switch to the other page.

Hope this helps! If this doesn’t answer your question, please let me know.

-Julie

Attachment
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.