Hi,
My code
System.Array' does not contain definition for 'FirstOrDefault
Thanks
Eric
My code
C#:
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Tools.Excel;
namespace ExcelWorkbook1
{
partial class ActionsPaneControl1 : UserControl
{
public ActionsPaneControl1()
{
InitializeComponent();
}
/*private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Opération terminée");
}*/
private void ActionsPaneControl1_Load(object sender, EventArgs e)
{
tabControl1.Appearance = TabAppearance.FlatButtons;
tabControl1.ItemSize = new System.Drawing.Size(0, 1);
tabControl1.SizeMode = TabSizeMode.Fixed;
SetDefault();
}
private bool SetDefault()
{
Microsoft.Office.Interop.Excel.Worksheet sh = Globals.ThisWorkbook.Application.Worksheets["Feuil3"];
Microsoft.Office.Interop.Excel.Range listRng = sh.Range["C15:C22"];
//Microsoft.Office.Interop.Excel.Range rng;
Control myCtrl;
foreach (Microsoft.Office.Interop.Excel.Range rng in listRng )
{
myCtrl = this.Controls.Find(rng.Value, true).FirstOrDefault(); <= error ?
myCtrl.Text = rng.Value.Offset(0, 1);
myCtrl.ForeColor = System.Drawing.Color.Gray;
}
return true;
}
Thanks
Eric
Last edited by a moderator: