I have to create a modular variable (string with no value) set as LN (txtLastName.Text) which takes its value once the user enters his Last Name and hits the submit button.
Also it shows in other sub procedures.
This is what the program is supposed to do:
Enter all the information in the given fields
When pressed Calculate button it should calculate and show a message on the right side under Tuition Confirmation.
Message should be the (Value of the Last Name Entered using Modular Variable) with some message.
Once Clicked Clear it should clear all the text and label fields (Last Name using Modular Variable)
Once Clicked on Exit button it should show a bye now message with Last Name (using Modular Variable)
Below is how I tried to define a Modular Variable
The issue is how to assign a value to the variable after it has taken it from the Text Box as it may change every time a new last name is entered.
'LN = as Last Name Public LN As String = " "
When Clicking Clear Button (Only few examples):
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click 'Clears all the textboxes and labels txtFirstName.Text = " " LN = " " <<--- here How do I assign a value to txtLastName.Text to LN? txtSchoolName.Text = " " txtNumofCour.Text = " " rptRed.Checked = False rptCoral.Checked = False
When Clicking Exit Button:
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click 'Shows a message box and exits the program MessageBox.Show("Bye for Now, " & LN & "!", "Time to go", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.Close()
When Clicking Calculate Button (Only the message portion):
lblTutConfValue.Text = txtStudentNum.Text & " / " & LN & ": Your payment to " & txtSchoolName.Text & " has been processed!"
All three of those needs values from txtLastName.Text textbox but its value should be assigned to Modular Variable LN and then applicable to all sub procedures in that frmMain.
I would greatly appreciate if someone can post the actual code and explain how it works?