hi,

i've to set some conditions to my program. user has to enter a string of 9 letters + numbers eg. x1234567y OR 12 numbers eg. 111111111111 before hitting the ok button (this ok button in my 1st form will direct me to my 2nd form if i keyed in correctly). the system will do a pop-up box telling u if u had keyed in an invalid no, that is not 9 letters + numbers nor 12 numbers.

can someone teach me to link the forms by adding in the needed codes with some explanation if u can, to my codes given below, in a way as simple as possible?

here's part of my codes for the 1st form:


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;


namespace WindowsApplication2

{
///
/// Summary description for MedicalApplication.
///
public class Form1 : System.Windows.Forms.Form
{
.
.
.
.
.
.
private void button8_Click(object sender, System.EventArgs e)
{
<<button8 will link to form 2
}


here's form 2:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace WindowsApplication3
{
///
/// Summary description for ToCreatePatientFileInDatabase.
///
public class ToCreatePatientFileInDatabase : System.Windows.Forms.Form
{
.
.
.
.
.
.


Thanks! i really appreciate your help..

try this im not sure what your asking but i think you want this

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;


namespace WindowsApplication2

{
/// 
/// Summary description for MedicalApplication.
/// 
public class Form1 : System.Windows.Forms.Form
{
.
.
. 
.
.
.
private void button8_Click(object sender, System.EventArgs e)
{
 frmAbout frm = new frmAbout();
            frm.ShowDialog(this);
            frm.Dispose();

// just change the form baout so it reads form 2 then when  you press the button it will take you to form 2
}

here's form 2:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace WindowsApplication3
{
/// 
/// Summary description for ToCreatePatientFileInDatabase.
/// 
public 

try this im not sure what your asking but i think you want this

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;


namespace WindowsApplication2

{
/// 
/// Summary description for MedicalApplication.
/// 
public class Form1 : System.Windows.Forms.Form
{
.
.
. 
.
.
.
private void button8_Click(object sender, System.EventArgs e)
{
 frmAbout frm = new frmAbout();
            frm.ShowDialog(this);
            frm.Dispose();

// just change the form baout so it reads form 2 then when  you press the button it will take you to form 2
}


here's form 2:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace WindowsApplication3
{
/// 
/// Summary description for ToCreatePatientFileInDatabase.
/// 
public 

tyspen READ, :rolleyes: he want to create a event that means it would have to be like this

 private void button8_Click(object sender, System.EventArgs e)
 {
string text = textBox1.Text;

if (text == "//your text//")

{
frmAbout frm = new frmAbout();
             frm.ShowDialog(this);
             frm.Dispose();
 }

else

{
MessageBox.Show("error : The key you typed is incorrect");
}


 // just change the form baout so it reads form 2 then when  you press the button it will take you to form 2
 }

tyspen READ, :rolleyes: he want to create a event that means it would have to be like this

private void button8_Click(object sender, System.EventArgs e)
 {
string text = textBox1.Text;

if (text == "//your text//")

{
frmAbout frm = new frmAbout();
             frm.ShowDialog(this);
             frm.Dispose();
 }

 // just change the form baout so it reads form 2 then when  you press the button it will take you to form 2
 }

My bad....:)

No problem tyspen dont,if you have a idea for project please tell me cause this days i dont have ideas for new projects

EDIT: (sry didnt mean to post this. Mods please delete)

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.