473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to get a pass code from form2 to form1

I am launching (form2.show()) from form1

In form2 the user has to enter a pass word. I need to pass this password off to form1 how do I do that?
Mar 29 '09 #1
3 2165
tlhintoq
3,525 Expert 2GB
I'm guessing its "password week" at some school because all of a sudden this week's theme on questions is how to pass passwords from one form to another.

Check the post 3 before yours

Mar 29 '09 #2
I still am confused is there something that is dumbed down a little more for the complete novice?
Mar 29 '09 #3
tlhintoq
3,525 Expert 2GB
I try to think of things in the order that I will use them Form1, Form2, Form3... then build them in reverse order.. Form3, Form2, Form1 for one very practical reason: I can't reference Form2 inside of Form1 if I haven't yet *built* Form2.

So build your Password form.
Put a UserName textbox on it
Put a Password textbox on it.

In your main form:
Expand|Select|Wrap|Line Numbers
  1. PasswordForm myPasswordForm = new PasswordForm();
  2. myPasswordForm.ShowDialog();
  3. string PassedInUsername = UserNameTextbox.text;
  4. string PassedInPassword = PasswordTextbox.text;
Can't get any simplier than that.
Mar 29 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Casey | last post by:
Yeah, I know this question was asked by someone elselike 2 weeks ago. But I need some additional help. I have a program I'm developing, and multiple different forms will be opened. For now though,...
4
by: Omar Llanos | last post by:
Recently, I posted a question on how to invoke a textbox control in Form1 (parent form) from within Form2 (which is inherited from Form1). Someone suggested to pass a reference of the Form1 to the...
5
by: Jason Huang | last post by:
Hi, In Global.cs, I have public string myString="". Another 2 forms are Form1.cs, Form2.cs. How do I use the Global.cs' myString to store a string in Form1 and then pass to Form2? Thanks for...
1
by: LCAdeveloper | last post by:
Can anyone help me with this? I'm trying to get an MDIChild form to lookup the value of a control on another open MDIChild form, but can't seem to get the right syntax. Let's say the two child...
3
by: swb76 | last post by:
I have a Object Oriented question. I got two forms - Form1 and Form2. I also got two classes Class1 and Class2 Form1 has objects Object1 - instance of Class1 and Object2 - instance of Class2. ...
3
by: =?Utf-8?B?UmljaCBIdXRjaGlucw==?= | last post by:
I have a form, Form1, that shows an instance of Form2 when a user clicks a button. On Form2, the user is to select items, Customer Names for example, from a datagrid control. When the user clicks a...
7
by: Boki | last post by:
Hi All, I can't pass data to another form: in form2: private void button1_Click(object sender, EventArgs e) { Form1 form_copy = new Form1();
8
by: AshParr | last post by:
Hi all, I have 2 forms, "Form1" & "Form2", i have a button that currently opens form2 from form1 and then hides itself: Form2 form2 = new Form2(); form2.show; this.Visible = False; and...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
6
by: =?Utf-8?B?Unlhbg==?= | last post by:
I am trying to pass a value from a texbox in Form1 to a textbox in Form2 using properties in VS2005 but it doesn't work; please help (project is attached). Code for Game Class: using System;...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.