0

On one form I have:

lblQuizName.Text = "Enter Quiz Name"

Later on I call a separate form:

frmQuizForStudents.Show()

How do I move the text from lblQuizName.Text into this form as it doesn't let me write a parameter when I call frmQuizForStudents.

Especially because it has Public Class frmQuizForStudents at the top, I cannot write: "Public Class frmQuizForStudents(lblQuizName)".

rwan
  • 1
  • 6
  • [Ask Google](https://www.google.de/search?q=how+do+I+pass+my+variable+between+two+forms+&ie=utf-8&oe=utf-8&client=firefox-b&gfe_rd=cr&ei=Ly8bWKHYGIvb8AeyyJewCg) – Alex B. Nov 03 '16 at 12:36

1 Answers1

0

You can create a new constructor using the parameter needed for your frmQuizForStudents form :

Public Class frmQuizForStudents

    sub new(QuizName as string)
         '... Code here
    end sub

end class

Also, to call this Form you will need to create a new instance of it before using the new parameter:

dim NewQuizForStudents as New frmQuizForStudents(lblQuizName.Text)
NewQuizForStudents.show
Quima
  • 894
  • 11
  • 21