my experience is two-three months of c++ programming (untill i realised that C# was more made for windows applications)
and two books (that i havent read all the way through)
the book i learnt the most from is "Programming Microsoft Windows with C# 2002" by Charles Petzold. I am allso learning a lot from the .NET framework 1.1 documentation.
The only thing that bothers me is that "OOP" thing you ceep refering to. I dont know how to connect the files, but i know how to compile several cs files to one exe with the command prompt. I made my own compiler, actually, with several .BAT files. i allso recently learnt how to make the program executable without the command line that follows with it. So i'd say i have done a lot in the few weeks i have known C#. And i like to get help in forums and sutch, since books dont ansver my more specific questions.
So can you please tell me how to connect several files?
Allso a problem i have: i have a form that pops up two other forms (for fun & training)
But when i open one of the forms and close it, it cannot be opened again. i yust get a weird error. I understand why it wont work, since my code only hides/shows the forms, and when i close a form, i cant show it again. Now how would i go about fixing that problem?
Code:
using System;
using System.Drawing;
using System.Windows.Forms;
static class Programm
{
static void Main()
{
Application.Run(new form1());
}
}
public class Dlg1 : Form
{
public Dlg1()
{
this.Text = "Form 1";
this.Size = new Size(300, 200);
}
}
public class Dlg2 : Form
{
public Dlg2()
{
this.Text = "Form 2";
this.Size = new Size(300, 200);
}
}
public class form1 : Form
{
private Dlg1 D1;
private Dlg2 D2;
public form1()
{
this.Text = "Form 1";
this.Size = new Size(130, 70);
this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
Button b1 = new Button();
b1.Size = new Size(50, 25);
b1.Parent = this;
b1.Text = "Form 1";
b1.Location = new Point(10, 10);
b1.Click += new EventHandler(click_b1);
b1.TabIndex = 0;
Button b2 = new Button();
b2.Size = new Size(50, 25);
b2.Parent = this;
b2.Text = "Form 2";
b2.Location = new Point(70, 10);
b2.Click += new EventHandler(click_b2);
b2.TabIndex = 1;
D1 = new Dlg1();
D2 = new Dlg2();
}
public void click_b1(object sender, EventArgs e)
{
D1.Show();
}
public void click_b2(object sender, EventArgs e)
{
D2.Show();
}
}