Click here to Skip to main content
15,906,626 members
Home / Discussions / C#
   

C#

 
GeneralRe: Please help me understand serial communication Pin
turbosupramk313-Feb-12 4:00
turbosupramk313-Feb-12 4:00 
AnswerRe: Please help me understand serial communication Pin
Luc Pattyn13-Feb-12 4:12
sitebuilderLuc Pattyn13-Feb-12 4:12 
GeneralRe: Please help me understand serial communication Pin
turbosupramk313-Feb-12 4:18
turbosupramk313-Feb-12 4:18 
GeneralRe: Please help me understand serial communication Pin
turbosupramk317-Feb-12 11:52
turbosupramk317-Feb-12 11:52 
AnswerRe: Please help me understand serial communication Pin
Luc Pattyn17-Feb-12 17:36
sitebuilderLuc Pattyn17-Feb-12 17:36 
GeneralRe: Please help me understand serial communication Pin
turbosupramk317-Feb-12 18:33
turbosupramk317-Feb-12 18:33 
AnswerRe: Please help me understand serial communication Pin
Dan Mos12-Feb-12 2:11
Dan Mos12-Feb-12 2:11 
GeneralRe: Please help me understand serial communication Pin
turbosupramk312-Feb-12 4:21
turbosupramk312-Feb-12 4:21 
GeneralRe: Please help me understand serial communication Pin
Dan Mos12-Feb-12 5:44
Dan Mos12-Feb-12 5:44 
AnswerRe: Please help me understand serial communication Pin
turbosupramk312-Feb-12 7:44
turbosupramk312-Feb-12 7:44 
Questioncom add in excel2010 Pin
PozzaVecia11-Feb-12 0:19
PozzaVecia11-Feb-12 0:19 
AnswerRe: com add in excel2010 Pin
Eddy Vluggen11-Feb-12 3:29
professionalEddy Vluggen11-Feb-12 3:29 
GeneralRe: com add in excel2010 Pin
PozzaVecia11-Feb-12 6:18
PozzaVecia11-Feb-12 6:18 
AnswerRe: com add in excel2010 Pin
Abhinav S11-Feb-12 5:08
Abhinav S11-Feb-12 5:08 
GeneralRe: com add in excel2010 Pin
PozzaVecia11-Feb-12 5:31
PozzaVecia11-Feb-12 5:31 
GeneralRe: com add in excel2010 Pin
Abhinav S11-Feb-12 17:04
Abhinav S11-Feb-12 17:04 
GeneralRe: com add in excel2010 Pin
PozzaVecia11-Feb-12 6:09
PozzaVecia11-Feb-12 6:09 
Questionocr from japenese to english using c# with MODI Pin
udayakumard10-Feb-12 23:21
udayakumard10-Feb-12 23:21 
AnswerRe: ocr from japenese to english using c# with MODI Pin
Dave Kreskowiak11-Feb-12 2:08
mveDave Kreskowiak11-Feb-12 2:08 
QuestionAccess is denied Pin
jon-8010-Feb-12 22:29
professionaljon-8010-Feb-12 22:29 
AnswerRe: Access is denied Pin
fjdiewornncalwe11-Feb-12 5:40
professionalfjdiewornncalwe11-Feb-12 5:40 
QuestionWriting to an excel file Pin
JFRobertson10-Feb-12 20:12
JFRobertson10-Feb-12 20:12 
I am new to working with com objects and trying to figure out how to make this work. The code runs and it hits the if statement and even writes out the test message in the if statement. The problem is that when I open the excel file there is no change. It did somehow corrupt one and tell me that it is read only now and it will occasionally pop up the do you want to save this excel file message, but nothing ever shows. I have also tried Value and Value2 as I have seen in various pages, but I just can't find anything that does what I want it to do or any place that even gives good help on how to do it. This is the code I am using. A lot of it is just hardcoded test values so it really should be straight forward.
var excelDocument = new Excel.Application();
Excel.Workbook xlWorkbook = excelDocument.Workbooks.Open(@"c:/score/W5490C - Fresh.xlsx");
Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
Excel.Range xlRange = xlWorksheet.UsedRange;
int rowCount = xlRange.Rows.Count;
int colCount = xlRange.Columns.Count;

//Calculate and record the air losses.
int totalAircraftLostAA = 0;
int totalAircraftLostSA = 0;
ScoreCalculations.CalculateEnemyAirLosses(events, ref totalAircraftLostAA, ref totalAircraftLostSA);
int column = 3;
for (int row = 1; row <= rowCount; row++)
{
if (xlRange.Cells[row, 1].Value2.ToString() == "Aircraft Kills (A-A)")
{
Console.WriteLine(xlWorkbook.Sheets[1]);
Console.WriteLine("write attempted");
xlRange.Cells[row, column].Value2 = totalAircraftLostAA;
}
}


//Calculate and record ally airlosses
ScoreCalculations.CalculateAllyAirLosses(events);

//Calculate and record expended Ordnance
ScoreCalculations.CalculateExpendedOrdnance(events);

//Calculate and record ground targets hit
ScoreCalculations.CalculateNamedGroundTargets(events);

xlWorkbook.Save();
xlWorkbook.Close();

Thanks to anyone that can see what is probably the dumb mistake that I am making.

Jimmy
AnswerRe: Writing to an excel file Pin
Richard MacCutchan10-Feb-12 23:48
mveRichard MacCutchan10-Feb-12 23:48 
GeneralRe: Writing to an excel file Pin
JFRobertson11-Feb-12 8:08
JFRobertson11-Feb-12 8:08 
GeneralRe: Writing to an excel file Pin
Richard MacCutchan11-Feb-12 23:32
mveRichard MacCutchan11-Feb-12 23:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.