1
Answer

ExcelWorksheet.Cells[row, col].value2 No Longer Works

Scott Stewart

Scott Stewart

Sep 26
499
1

I have a class in my project that accesses Excel worksheets. After upgrading from .Net 4.8 to .Net 8.0, every line using the "value2' or 'value' is an error. The class wont even compile. I made sure to add Microsoft.Office.Interop..Excel to the dependencies. The error is;

CS1061    'object' does not contain a definition for 'Value2' and no accessible extension method 'Value2' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)   

Does anyone know what I can do to fix this?

Thanks,

Answers (1)
0
Jasbeer Singh

Jasbeer Singh

NA 7.1k 554k 8y
Hi Rishav,
 
you can fetch data and bind it dynamically according to question no. and options.
you can take radiobutton list to bind the options dynamically.
you can bind the daasource to radiobutton list.
 
 
 
 
0
Nitin Sontakke

Nitin Sontakke

137 13.6k 15.2k 8y
Not sure if you are using any framework (EF, etc)
 
You will need to do this in code. Assume, you get either 1 or 2 or 3 or 4 from the database.
 
Then, in c# you write (something) like this...
 
radioButton1.checked = radioButton2.checked = radioButton3.checked = radioButton.checked = false; 
switch(radioButtonValueFromDb) 
{
   case 1:
       radioButton1.checked = true;
 
//all other 3 values...