char[] rager
New Member
- Joined
- Jun 9, 2010
- Messages
- 310 (0.06/day)
- Location
- Massachusetts Institute of Technology, Computer Sc
System Name | Obsidianight |
---|---|
Processor | Intel Core i7 950 @ ~ 4 GHz |
Motherboard | Asus P6T Deluxe |
Cooling | Custom Liquid Cooling |
Memory | 6GB (3 x 2GB) Corsair XMS3 DDR3 Triple-Channel @ ~ 1.6 GHz (9-9-9-24-1T) |
Video Card(s) | Zotac AMP! GTX 580 @ 900 MHz Core / 1025 MHz Memory / 1800 MHz Shader |
Storage | 180 GB OCZ Vertex 2 SSD |
Display(s) | Sceptre 24 Inch (1920 x 1200) 2 MS Response |
Case | Corsair Obsidian 800D |
Audio Device(s) | Onboard |
Power Supply | 1 kW Antec TruePower Quattro |
Software | Microsoft Windows 7 Ultimate 64-Bit / Linux Mint 9 And Fedora 13 KDE Through VirtualBox |
Here Is My Form1.cs:
Here Is My FormMain.cs:
As one can tell from my Form1 code, I am trying to open FormMain after the password is validated. However, how can I open FormMain from Form1 and close Form1 without closing FormMain? I ask this, because, even though the Close() function is called in Form1, it shuts both Form1 and FormMain down?
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Login
{
public partial class Form1 : Form
{
int wrongCounter = 0;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text != "a")
{
wrongCounter++;
if (wrongCounter == 2)
{
Close();
}
textBox1.Clear();
label1.Visible = true;
}
else
{
FormMain form = new FormMain();
form.Show();
Close();
}
}
}
}
Here Is My FormMain.cs:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Login
{
public partial class FormMain : Form
{
public FormMain()
{
InitializeComponent();
}
}
}
As one can tell from my Form1 code, I am trying to open FormMain after the password is validated. However, how can I open FormMain from Form1 and close Form1 without closing FormMain? I ask this, because, even though the Close() function is called in Form1, it shuts both Form1 and FormMain down?