Hey guys

I have 2 forms. One is a log in screen and another is a main menu. I need to retrieve the data from the textbox in the login screen to the textbox in the main menu.

I have sourced around the internet and have implemented this code into where the main menu loads TextBox1.Text = FrmLogIn.TxtUserName.Text This code works however everytime I log out and log back in again, the textbox which is meant to be retrieving the code from the login screen, remains empty!! ...........
I have a clearfields() function located in logout button to empty the textbox....if that helps

Do any of you guys have an idea where Im going wrong??

Thanks in advanced :)

Recommended Answers

All 4 Replies

You are probably closing the form which will set the textbox to empty.
When you bring up your logon form copy the text you saved back to the logon form.

FrmLogIn.TxtUserName.Text = TextBox1.Text

or hide login form (don't close it). so value of txtusername still exist.

Hey guys I have solved the problem through other means

What my object was to be able to register times the user logs in and register times the user logs out of the system.

Logging in was no problem, I just registered the value in the textbox along with the date at the time.

Logging out was the problem as I couldnt transfer the username from the login screen to the mein menu so then once logout was initiated it would take the value out of the textbox and register it.

However I managed this by not initially clearing the contents of the login form once logged in and once it came to logging out the form, i would register the username inputted into the the frm log in and then clear the contents of the log in form.

I hope I explained it clearly,

but thanks again for your input guys, your the ones that gave me the idea.
:)

Hey

you can also used this one

Private Sub ButtonOk_Click
Dim obj as new frm_MainMenu

obj.txtbox2.text = txt1.text

End Sub

ok?! hope you get it dude!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.