Click here to Skip to main content
15,920,688 members
Home / Discussions / C#
   

C#

 
GeneralRe: Connection open while sending Email with SmtpClient Pin
logicaldna22-Nov-06 3:25
logicaldna22-Nov-06 3:25 
GeneralRe: Connection open while sending Email with SmtpClient Pin
ednrgc22-Nov-06 3:29
ednrgc22-Nov-06 3:29 
GeneralRe: Connection open while sending Email with SmtpClient Pin
logicaldna22-Nov-06 3:35
logicaldna22-Nov-06 3:35 
GeneralRe: Connection open while sending Email with SmtpClient Pin
coolestCoder22-Nov-06 3:23
coolestCoder22-Nov-06 3:23 
GeneralRe: Connection open while sending Email with SmtpClient Pin
logicaldna22-Nov-06 3:48
logicaldna22-Nov-06 3:48 
GeneralRe: Connection open while sending Email with SmtpClient Pin
coolestCoder22-Nov-06 3:19
coolestCoder22-Nov-06 3:19 
GeneralRe: Connection open while sending Email with SmtpClient Pin
logicaldna22-Nov-06 3:28
logicaldna22-Nov-06 3:28 
QuestionC# Adding to An ArrayList Pin
Kris10022-Nov-06 2:02
Kris10022-Nov-06 2:02 
hello programmers!
im creating an application to hold my dvd collection (lame, but i have to start somewhere!)
and im having problems adding a DVD object to an ArrayList.

basically...i have a "DVD" object which is coded as follows:-

using System;
using System.Collections;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Soap;
using System.Windows.Forms;

namespace DVDDatabase
{
[Serializable]
public class DVD
{
//DVD Properties
public string strTitle;
public int intBoxLocation;
public int intBoxNumber;
public DateTime dtDateAdded;
public int intYear;
public string strGenre;
public string strDirector;
public bool boolWatched;
}

[Serializable]
public class Collection
{
public ArrayList arrDVDCollection;
}
}

(note this is in a seperate .cs file)
so, what i want to do is create an instance of "Collection" at run time right? so, my main method is as follows...

static void Main()
{

//Starts The Application
//Load Preliminary Objects
Collection DVDCollection = new Collection(); <<--HERE IT IS!

//Load GUI
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainMenu());
}

ok, so now, on an "Add DVD" button that i have on a SEPERATE form (called AddDVD.cs) i need a command to add the current DVD object to the array list...here we go again!

private void btnAddDVD_Click(object sender, EventArgs e)
{
//create new instance of dvd object
DVD newDVD = new DVD();
//set properties
//set Title
newDVD.strTitle = txtTitle.Text;
//add Dateadded code here
//Set Year
try
{
newDVD.intYear = int.Parse(numYear.Text);
}
catch (Exception)
{
MessageBox.Show("Please Input A Number For Year");
}
//set Director
newDVD.strDirector = txtDirector.Text;
//add Gennre Code Here
//set BoxNo
try
{
newDVD.intBoxNumber = int.Parse(txtBoxNo.Text);
}
catch (Exception)
{
MessageBox.Show("Please Input A Number For Box Number");
}
//set BoxLocation
try
{
newDVD.intBoxLocation = int.Parse(txtBoxLocation.Text);
}
catch (Exception)
{
MessageBox.Show("Please Input A Number For Box Location");
}
//Set Watched Bool
newDVD.boolWatched = chkWatched.Checked;

//add to array list
DVDCollection.arrDVDCollection.Add(newDVD); <<-HERE IT IS!
//Clear form
}

yeah i know i havent coded everything, but im getting there!

anyway, when i compile i get the following email message:-

"the name DVD Collection does not exist within the current context"

i think this is because the original ArrayList definition is not being referenced on the above form (or something like that) but i am unsure how to go about doing that.

if somebody can understand any of that mess i have just written out and offer some help, i would be very thankful

Kris Smile | :)
AnswerRe: C# Adding to An ArrayList Pin
ednrgc22-Nov-06 2:14
ednrgc22-Nov-06 2:14 
AnswerRe: C# Adding to An ArrayList Pin
Eduard Keilholz22-Nov-06 2:37
Eduard Keilholz22-Nov-06 2:37 
AnswerRe: C# Adding to An ArrayList Pin
Steve Hansen22-Nov-06 3:11
Steve Hansen22-Nov-06 3:11 
QuestionHow to create shared assembly and how to invoke shared assembly. Pin
Gopal Hatekar22-Nov-06 1:39
Gopal Hatekar22-Nov-06 1:39 
AnswerRe: How to create shared assembly and how to invoke shared assembly. Pin
Eduard Keilholz22-Nov-06 2:35
Eduard Keilholz22-Nov-06 2:35 
GeneralRe: How to create shared assembly and how to invoke shared assembly. Pin
Gopal Hatekar22-Nov-06 18:09
Gopal Hatekar22-Nov-06 18:09 
GeneralRe: How to create shared assembly and how to invoke shared assembly. Pin
Eduard Keilholz22-Nov-06 20:12
Eduard Keilholz22-Nov-06 20:12 
GeneralRe: How to create shared assembly and how to invoke shared assembly. Pin
Gopal Hatekar22-Nov-06 20:18
Gopal Hatekar22-Nov-06 20:18 
Questionildasm.exe Pin
saqib8222-Nov-06 1:14
saqib8222-Nov-06 1:14 
AnswerRe: ildasm.exe Pin
ednrgc22-Nov-06 2:17
ednrgc22-Nov-06 2:17 
AnswerRe: ildasm.exe Pin
Paul Conrad22-Nov-06 4:25
professionalPaul Conrad22-Nov-06 4:25 
QuestionGet the remote username of a file action Pin
ronjon_nl22-Nov-06 0:57
ronjon_nl22-Nov-06 0:57 
QuestionReplacing a string in a file Pin
sanki77922-Nov-06 0:29
sanki77922-Nov-06 0:29 
AnswerRe: Replacing a string in a file Pin
stancrm22-Nov-06 0:34
stancrm22-Nov-06 0:34 
GeneralRe: Replacing a string in a file Pin
sanki77922-Nov-06 1:13
sanki77922-Nov-06 1:13 
GeneralRe: Replacing a string in a file Pin
stancrm22-Nov-06 1:15
stancrm22-Nov-06 1:15 
QuestionHow can I have access to an arraylist Pin
Schmullus21-Nov-06 23:40
Schmullus21-Nov-06 23:40 

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.