PDA

View Full Version : خطا در استفاده از دستور System.Threading.Thread.CurrentThread.CurrentCultu



sohrabi1383
یک شنبه 03 فروردین 1393, 16:44 عصر
در کد زیر 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;
using Microsoft.Office.Interop.Excel;

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

private void button1_Click(object sender, EventArgs e)
{
System.Threading.Thread.CurrentThread.CurrentCultu re = new System.Globalization.CultureInfo("en-US");
Microsoft.Office.Interop.Excel.Application exlApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook exlBook = exlApp.Workbooks.Add(XlSheetType.xlWorksheet);
Microsoft.Office.Interop.Excel.Worksheet exlWsheet = (Worksheet)(exlBook.Worksheets);
exlWsheet.DisplayRightToLeft = true;
string CellAddress = "A1";
Range[] rng = new Range[100];
rng[1] = exlWsheet.get_Range(CellAddress, CellAddress);
rng[1].Value2 = "hello";


}
}
}


برای نوشتن hello در خانه A1 در سطر 22 یعنی
System.Threading.Thread.CurrentThread.CurrentCultu re = new System.Globalization.CultureInfo("en-US");
برنامه اشکال زیر را می گیرد
Error 1 'System.Threading.Thread.CurrentThread' is a 'property' but is used like a 'type' C:\Documents and Settings\abc\My Documents\Visual Studio 2008\Projects\excel3\excel3\Form1.cs 22 37 excel3


علت این مشکل چیست فایل برنامه را نیز ضمیمه کرده ام