Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# Basic Pin
Guffa1-Sep-07 2:32
Guffa1-Sep-07 2:32 
GeneralRe: C# Basic Pin
XFighter1-Sep-07 6:21
XFighter1-Sep-07 6:21 
GeneralRe: C# Basic Pin
Guffa1-Sep-07 9:05
Guffa1-Sep-07 9:05 
QuestionSimulated mouse clicks Pin
Opa Knack1-Sep-07 1:10
Opa Knack1-Sep-07 1:10 
AnswerRe: Simulated mouse clicks Pin
Vasudevan Deepak Kumar1-Sep-07 1:35
Vasudevan Deepak Kumar1-Sep-07 1:35 
AnswerRe: Simulated mouse clicks Pin
Kristian Sixhøj2-Sep-07 8:41
Kristian Sixhøj2-Sep-07 8:41 
Questionuser control grid with dropdown Pin
dsaikrishna1-Sep-07 0:53
dsaikrishna1-Sep-07 0:53 
QuestionForms and Data please help. Pin
XFighter1-Sep-07 0:44
XFighter1-Sep-07 0:44 
I recently read an article about how Passing data between forms.(http://www.codeproject.com/useritems/pass_data_between_forms.asp)
What it fails to explain(or I fail to understand) is how do I do it whilst I don't create objects of the form?
Here is the code below, abit long but simple...
I want data from the second form to be passed to the first form(then I could show it with labels)
[code]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace AutoDownloader
{
public partial class Form1 : Form
{


public Form1()
{
Initiailize();
}
public void Initiailize()
{
this.Width=800;
this.Height=400;
this.StartPosition= FormStartPosition.CenterScreen;

Button AddShow = new Button();
AddShow.Click+=new EventHandler(AddShow_Click);

AddShow.Top = 300;
AddShow.Left = 20;
AddShow.Width = 100;
AddShow.Text = "Add New Show";

this.Controls.Add(AddShow);


}
public void AddShow_Click(object sender, System.EventArgs e)
{
AddShowForm subform=new AddShowForm();
subform.Show();

}

}
public class AddShowForm : Form
{
Label NewShow = new Label();
Label DownloadDate = new Label();
Label DownloadTime = new Label();
Label DownloadWebsite = new Label();
TextBox tNewShow = new TextBox();
TextBox tDownloadDate = new TextBox();
TextBox tDownloadTime = new TextBox();
TextBox tDownloadWebsite = new TextBox();
Button Save = new Button();
Button CloseForm = new Button();



public AddShowForm()
{
Start();
}
public void Start()
{
this.Width = 600;
this.Height = 250;
this.StartPosition = FormStartPosition.CenterScreen;

NewShow.Left = 10;
DownloadDate.Left = 10;
DownloadTime.Left = 10;
DownloadWebsite.Left = 10;

NewShow.Top = 20;
DownloadDate.Top = 50;
DownloadTime.Top = 80;
DownloadWebsite.Top = 110;

tNewShow.Left = 330;
tDownloadDate.Left = 330;
tDownloadTime.Left = 330;
tDownloadWebsite.Left = 330;

tNewShow.Top = 20;
tDownloadDate.Top = 50;
tDownloadTime.Top = 80;
tDownloadWebsite.Top = 110;

NewShow.Width = 300;
DownloadDate.Width = 300;
DownloadTime.Width = 300;
DownloadWebsite.Width = 300;

CloseForm.Click += new EventHandler(CloseForm_Click);
Save.Click += new EventHandler(SaveData);
Save.Top =150;
Save.Left = 10;
CloseForm.Top = 150;
CloseForm.Left =100;
Save.Text = "Save Data";
CloseForm.Text = "Close";

NewShow.Text = "Enter the name of show to search:";
DownloadDate.Text = "Enter the date you'd like to download the show:";
DownloadTime.Text = "Enter the time you'd like to download the show:";
DownloadWebsite.Text = "Enter the name of website which you want to download from:";

this.Controls.Add(NewShow);
this.Controls.Add(DownloadDate);
this.Controls.Add(DownloadTime);
this.Controls.Add(DownloadWebsite);
this.Controls.Add(tNewShow);
this.Controls.Add(tDownloadDate);
this.Controls.Add(tDownloadTime);
this.Controls.Add(tDownloadWebsite);
this.Controls.Add(Save);
this.Controls.Add(CloseForm);


}
public void CloseForm_Click(object sender, System.EventArgs e)
{
this.Visible = false;

}
public void SaveData(object sender, System.EventArgs e)
{
this.BackColor = Color.Red;


}
}
}
[/code]
AnswerRe: Forms and Data please help. Pin
Vasudevan Deepak Kumar1-Sep-07 2:33
Vasudevan Deepak Kumar1-Sep-07 2:33 
Questionhow to check file is open or not Pin
Situ1431-Aug-07 22:57
Situ1431-Aug-07 22:57 
AnswerRe: how to check file is open or not Pin
Vasudevan Deepak Kumar1-Sep-07 0:26
Vasudevan Deepak Kumar1-Sep-07 0:26 
GeneralRe: how to check file is open or not Pin
Situ141-Sep-07 0:39
Situ141-Sep-07 0:39 
GeneralRe: how to check file is open or not Pin
Vasudevan Deepak Kumar1-Sep-07 0:43
Vasudevan Deepak Kumar1-Sep-07 0:43 
GeneralRe: how to check file is open or not Pin
Situ141-Sep-07 1:00
Situ141-Sep-07 1:00 
AnswerRe: how to check file is open or not Pin
Vasudevan Deepak Kumar1-Sep-07 1:37
Vasudevan Deepak Kumar1-Sep-07 1:37 
QuestionSeperate Thread/BackgroundWorker Pin
RichardContact-131-Aug-07 22:41
RichardContact-131-Aug-07 22:41 
AnswerRe: Seperate Thread/BackgroundWorker Pin
Vasudevan Deepak Kumar1-Sep-07 1:37
Vasudevan Deepak Kumar1-Sep-07 1:37 
QuestionFilling a column in datagrid (am I doing it the right way??) Pin
Muammar©31-Aug-07 20:27
Muammar©31-Aug-07 20:27 
AnswerRe: Filling a column in datagrid (am I doing it the right way??) Pin
Muammar©1-Sep-07 1:49
Muammar©1-Sep-07 1:49 
QuestionHelp about MSChart. Pin
kcynic31-Aug-07 16:29
kcynic31-Aug-07 16:29 
AnswerRe: Help about MSChart. Pin
Vasudevan Deepak Kumar1-Sep-07 1:30
Vasudevan Deepak Kumar1-Sep-07 1:30 
Questionjhgjhgjk Pin
seemamltn31-Aug-07 14:53
seemamltn31-Aug-07 14:53 
QuestionRe: jhgjhgjk Pin
Sonia Gupta31-Aug-07 18:33
Sonia Gupta31-Aug-07 18:33 
AnswerRe: jhgjhgjk Pin
N a v a n e e t h31-Aug-07 19:06
N a v a n e e t h31-Aug-07 19:06 
AnswerRe: jhgjhgjk Pin
Muammar©31-Aug-07 22:44
Muammar©31-Aug-07 22:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.