Click here to Skip to main content
15,883,984 members
Home / Discussions / C#
   

C#

 
GeneralRe: Connection string Error VS to Mysql Pin
Richard MacCutchan19-Mar-22 2:24
mveRichard MacCutchan19-Mar-22 2:24 
QuestionGoogle Map Pin
Luis M. Rojas18-Mar-22 10:46
Luis M. Rojas18-Mar-22 10:46 
AnswerRe: Google Map Pin
Luc Pattyn18-Mar-22 11:19
sitebuilderLuc Pattyn18-Mar-22 11:19 
AnswerRe: Google Map Pin
OriginalGriff18-Mar-22 21:06
mveOriginalGriff18-Mar-22 21:06 
QuestionC# TCPClient Connect not working when VPN is present. Pin
BlueTblue17-Mar-22 0:44
BlueTblue17-Mar-22 0:44 
AnswerRe: C# TCPClient Connect not working when VPN is present. Pin
Dave Kreskowiak17-Mar-22 2:39
mveDave Kreskowiak17-Mar-22 2:39 
GeneralRe: C# TCPClient Connect not working when VPN is present. Pin
Ashley Glenister17-Mar-22 6:16
Ashley Glenister17-Mar-22 6:16 
QuestionProblems when reading a Excel file with numbers. Pin
jwradhe17-Mar-22 0:31
jwradhe17-Mar-22 0:31 
Hi!
When i run my code with a excel document with words in, it works, but at fast as i read a document with numbers only i get error on marked line in code.

if (c.DataType.Value == CellValues.SharedString)


and the error is:
An error occurred!!!: The object reference has not been specified to an instance of an object.


I have a little hard to see why this happends, hope on you experts!

C#
using (SpreadsheetDocument myDoc = SpreadsheetDocument.Open(input, true))
                {

                    WorkbookPart workbookPart = myDoc.WorkbookPart;
                    WorksheetPart worksheetPart = workbookPart.WorksheetParts.First();
                    SheetData sheetData = worksheetPart.Worksheet.Elements<SheetData>().First();
 
                    foreach (Row r in sheetData.Elements<Row>())
                    {

                        foreach (Cell c in r.Elements<Cell>())
                        {


                            string value = c.InnerText;


                            if (c.DataType.Value == CellValues.SharedString)
                            {

                                var stringTable = workbookPart.GetPartsOfType<SharedStringTablePart>()
                                        .FirstOrDefault();
                                if (stringTable != null)
                                {
                                    value = stringTable.SharedStringTable.ElementAt(int.Parse(value)).InnerText;
                                    GenerateBarcodeFromExcel(value, output);
                                }

                            }
                            else
                            {
                                GenerateBarcodeFromExcel(c.CellValue.Text, output);
                            }
                               
                        }
                    }

                    myDoc.Close();

AnswerRe: Problems when reading a Excel file with numbers. Pin
Estys17-Mar-22 1:32
Estys17-Mar-22 1:32 
GeneralRe: Problems when reading a Excel file with numbers. Pin
jwradhe17-Mar-22 2:34
jwradhe17-Mar-22 2:34 
QuestionI want the MySQL 5.7.21 server to be installed from my application Pin
Member 1227854216-Mar-22 7:59
Member 1227854216-Mar-22 7:59 
AnswerRe: I want the MySQL 5.7.21 server to be installed from my application Pin
OriginalGriff16-Mar-22 9:27
mveOriginalGriff16-Mar-22 9:27 
GeneralRe: I want the MySQL 5.7.21 server to be installed from my application Pin
Member 1227854218-Mar-22 4:45
Member 1227854218-Mar-22 4:45 
GeneralRe: I want the MySQL 5.7.21 server to be installed from my application Pin
RobertSF18-Mar-22 7:24
professionalRobertSF18-Mar-22 7:24 
QuestionHow to read a Card Reader in C# ? Pin
Filip D. Williams14-Mar-22 23:57
Filip D. Williams14-Mar-22 23:57 
AnswerRe: How to read a Card Reader in C# ? Pin
Richard MacCutchan15-Mar-22 1:11
mveRichard MacCutchan15-Mar-22 1:11 
QuestionWhat are Good Things to Know in a C# Interview? Pin
Xarzu14-Mar-22 11:52
Xarzu14-Mar-22 11:52 
AnswerRe: What are Good Things to Know in a C# Interview? Pin
OriginalGriff14-Mar-22 12:29
mveOriginalGriff14-Mar-22 12:29 
AnswerRe: What are Good Things to Know in a C# Interview? Pin
Dave Kreskowiak14-Mar-22 14:36
mveDave Kreskowiak14-Mar-22 14:36 
GeneralRe: What are Good Things to Know in a C# Interview? Pin
lmoelleb14-Mar-22 23:28
lmoelleb14-Mar-22 23:28 
GeneralRe: What are Good Things to Know in a C# Interview? Pin
Member 1227854218-Mar-22 8:25
Member 1227854218-Mar-22 8:25 
AnswerRe: What are Good Things to Know in a C# Interview? Pin
Eddy Vluggen14-Mar-22 14:39
professionalEddy Vluggen14-Mar-22 14:39 
Questionc sharp Pin
vishnu satpathy12-Mar-22 7:26
vishnu satpathy12-Mar-22 7:26 
AnswerRe: c sharp Pin
OriginalGriff12-Mar-22 7:37
mveOriginalGriff12-Mar-22 7:37 
QuestionSend a mail that has Arabic characters using Gmail API Pin
mahmoud199011-Mar-22 11:05
mahmoud199011-Mar-22 11:05 

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.