What I want to do is add videos to a list available for rent.
In the “main” form when I click “Add” then the frmAddVideo appears where I need to insert all the video’s information. (This works 100% but…) In the frmAddVideo form there is a comboBox with values “Yes” and “No” for the availability of the video. When “Yes” is selected then the video displayed in the dataGridVideo after it is added, there must be a “ticked” checkbox in the dataGridView and vice versa for when it’s not available.
Also when I click "View" on the main form I can view all the video's information. In this form it gives all the video's info and the availability must say "Yes" in the ComboBox if the video is checked in the dataGridView.
How can I do all this with a bool statement for availability and how will it look in my class? I provided code but I don’t think it is correct seeing that it does not work. I am not providing the main form because it is not necessary.
Video class
namespace A6
{
[Serializable]
class Video
{
private string mTitle;
private string mCategory;
private int mYearReleased;
private double mRunTime;
//bool mAvailability;
public string Title
{
get { return mTitle; }
set { mTitle = value; }
}
public string Category
{
get { return mCategory; }
set { mCategory = value; }
}
public int YearReleased
{
get { return mYearReleased; }
set { mYearReleased = value; }
}
public double RunTime
{
get { return mRunTime; }
set { mRunTime = value; }
}
//DO AVAILABILITY
//CONSTRUCTOR
public Video()
{
mTitle = "No Name";
mCategory = "No Category";
mYearReleased = 0;
mRunTime = 0;
}
}
}
frmAddVideo
namespace A6
{
public partial class FrmAddVideo : Form
{
internal Video NewVideo;
public FrmAddVideo()
{
InitializeComponent();
}
//ADD VIDEO
private void button1_Click_1(object sender, EventArgs e)
{
NewVideo = new Video();
NewVideo.Title = textBox1.Text;
NewVideo.Category = Convert.ToString(comboBox1.SelectedItem);
NewVideo.YearReleased = Convert.ToInt32(numericUpDown1.Value);
NewVideo.RunTime = Convert.ToDouble(textBox2.Text);
//STILL HAVE TO IMPLEMENT THE AVAILABILITY???
MessageBox.Show("Video added");
this.Close();
}
}
}
frmViewVideo
namespace A6
{
public partial class frmViewVideo : Form
{
internal Video NewVideo;
public frmViewVideo()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void frmViewVideo_Load(object sender, EventArgs e)
{
textBox1.Text = NewVideo.Title;
textBox2.Text = Convert.ToString(NewVideo.RunTime);
numericUpDown1.Value = NewVideo.YearReleased;
comboBox1.SelectedItem = Convert.ToString(NewVideo.Category);
//comboBox2.SelectedItem = Convert.ToString(NewVideo.BOOL METHOD??);
}
}
}
The rest of the application works perfectly. Just can't figure out what to do with the bool statement for availability.
Thanks a lot guys!
J