2012-03-12 100 views
0

下面我的(相当)简单的应用程序的下面的图像是它的代码。我需要知道如何将comboBox1(Location),comboBox2(Medication),textBox1(Quantity)和textBox2(Date)导出到CSV或Excel类型的文件中,以运行报告。我是C#的两周新手,并且可以真正使用帮助,因为我一直在做这方面的工作,具体工作了大约一周!试图写入结果并将结果附加到文件

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Windows.Forms; 

namespace WindowsFormsApplication1 
{ 
     public partial class Form1 : Form 
     { 
       public Form1() 
       { 
        InitializeComponent(); 
       } 

       private void button1_Click(object sender, EventArgs e) 
       { 

       } 

       private void button2_Click(object sender, EventArgs e) 
       { 

       } 

       private void button3_Click(object sender, EventArgs e) 
       { 
        Application.Exit(); 
       } 

       private void exitToolStripMenuItem_Click(object sender, EventArgs e) 
       { 
        Application.Exit(); 
       } 

       private void toolStripMenuItem1_Click(object sender, EventArgs e) 
       { 
       } 

       private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) 
       { 
       } 

       private void dateTimePicker1_ValueChanged(object sender, EventArgs e) 
       { 
        dateTimePicker1.CustomFormat = "dd/MM/yyyy"; 
        dateTimePicker1.MinDate = DateTime.Today; 
        dateTimePicker1.MaxDate = DateTime.Today; 
       } 

       private void label4_Click(object sender, EventArgs e) 
       { 
       } 

       private void textBox2_TextChanged(object sender, EventArgs e) 
       { 
        textBox2.Text = DateTime.Now.ToString(); 
       } 


     } 
}][1] 
+0

我很抱歉,那是因为我是StackOverflow.com上的noob,我无法发布专业版的图片公克。但有三个按钮。点击“Button1”后,我希望将两个组合框和文本框中的选择输出到csv文件或类似的东西。 – Geo 2012-03-12 19:52:09

+2

那么你试过了什么,当你尝试过时发生了什么? – 2012-03-12 19:52:58

+0

你做过任何研究吗?这是一个相当简单的任务。 – 2012-03-12 19:53:38

回答