宣布公共班级社区活动 [英] Declare Public Class Community Event

查看:55
本文介绍了宣布公共班级社区活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

Hello,

我正在寻找创建类声明 社区活动 票务信息

I'm looking to create a class declaration community Event in a Ticket Information project.

类社区活动

The Class community Event will be used to store data that is retrieved from a file called calendar.txt which is created and populated by a different project. This class will contain the following private instance variables:

变量名称

变量类型

说明

dayValue

整数

活动日期

timeValue

timeValue

字符串

活动时间

priceValue

priceValue

十进制

活动价格

eventNameValue

eventNameValue

字符串

事件名称

descriptionValue

descriptionValue

字符串

事件描述

由于这些变量是私有变量,因此无法从类外部直接访问.为了使客户端能够读取或写入这些变量,我想提供可读取变量的属性 和修改.这些属性的名称为:

As these variables are private they cannot be directly accessed from outside the class. To enable clients to read or write to these variables I want to provide properties which will enable the variables to be read and modified. The names of these properties are:

•时间

•价格

•名称

•说明

这些变量中的每一个都应该是可读写的,并且属性应验证数据,以确保只能将有效数据分配给变量.

Each of these variables should be readable and writeable and the properties should validate the data to ensure that only valid data can be assigned to the variables.

请参见下面的代码.

谢谢

public partial class TicketInformationForm : Form
   {
      public TicketInformationForm()
      {
         InitializeComponent();
      }

      private void dateMonthCalendar_DateChanged(object sender, DateRangeEventArgs e)
      {

      }

      private void eventComboBox_SelectedIndexChanged(object sender, EventArgs e)
      {

         if (eventComboBox.SelectedIndex == 0)
         {

            descriptionTextBox.Text = "2.30PM. Price 12.50. Take part in creating various types of Arts & Crafts at this fair.";


         }


         if (eventComboBox.SelectedIndex == 1)
         {
            descriptionTextBox.Text = "4.30PM. Price 00.00. Take part in cleaning the local Park.";

         }

         if (eventComboBox.SelectedIndex == 2)
         {

            descriptionTextBox.Text = "1.30PM. Price 10.00. Take part in selling goods.";

         }

         if (eventComboBox.SelectedIndex == 3)
         {

            descriptionTextBox.Text = "12.30PM. Price 10.00. Take part in a game of rounders in the local Park.";

         }

         if (eventComboBox.SelectedIndex == 4)
         {

            descriptionTextBox.Text = "11.30PM. Price 15.00. Take part in an Egg & Spoon Race in the local Park";

         }

         if (eventComboBox.SelectedIndex == 5)

         {

            descriptionTextBox.Text = "No Events today.";
            
         }

      }

      private void descriptionTextBox_TextChanged(object sender, EventArgs e)
      {

      }
   }
}

推荐答案

@ Bennett James,

@ Bennett James,

您必须将相关问题发布到C#论坛.现在,我将帮助您进行移动.

You have to post related issue to C# forum. I'll help you move it now.

此外,您还能阅读本文 首先http://msdn.microsoft.com/zh-cn/library/w86s7x04.aspx ,然后尝试自己创建此类?

And what's more, can you read this article http://msdn.microsoft.com/en-us/library/w86s7x04.aspx first and then try create this class yourself?

如果您当时遇到任何问题,那么对于其他人来说,这个问题将更有意义.

If you meet any problem at that time, than that question will make sense to others.

此致


这篇关于宣布公共班级社区活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆