Click here to Skip to main content
15,890,512 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I read data from USB Virtual COM in C#? Pin
Gerry Schmitz23-Dec-15 16:11
mveGerry Schmitz23-Dec-15 16:11 
AnswerRe: How do I read data from USB Virtual COM in C#? Pin
Luc Pattyn23-Dec-15 17:24
sitebuilderLuc Pattyn23-Dec-15 17:24 
GeneralRe: How do I read data from USB Virtual COM in C#? Pin
naouf1026-Dec-15 3:44
naouf1026-Dec-15 3:44 
GeneralRe: How do I read data from USB Virtual COM in C#? Pin
Agent__00730-Dec-15 15:45
professionalAgent__00730-Dec-15 15:45 
QuestionIs there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin23-Dec-15 0:03
Emanuele Bonin23-Dec-15 0:03 
AnswerRe: Is there a better way to call Same Methods on different objects ? Pin
Richard MacCutchan23-Dec-15 0:30
mveRichard MacCutchan23-Dec-15 0:30 
AnswerRe: Is there a better way to call Same Methods on different objects ? Pin
Eddy Vluggen23-Dec-15 1:49
professionalEddy Vluggen23-Dec-15 1:49 
AnswerRe: Is there a better way to call Same Methods on different objects ? Pin
BillWoodruff23-Dec-15 5:04
professionalBillWoodruff23-Dec-15 5:04 
Based on what I see here:

1. 'fs ... whatever that is ... is invariant

2. you are creating new instances of HSSF... and XSSF... in the scope of a 'switch statement just to get access to methods "in" them. That's a waste.

Think about creating one instance each of HSSF... and XSSF... outside the 'switch statement ... and, then, re-use them ... assuming those Classes are not doing some strange self-modifying voodoo.

And, you really should use StringBuilder here:
C#
XSSFWorkbook Xwb = new XSSFWorkbook(fs);
HSSFWorkbook Hwb = new HSSFWorkbook(fs);

XSSFSheet Xsh; // what is this ?

StringBuilder sb = new StringBuilder();

String Sheets;
 
switch (Type) {
    case XLSType.XLS:
        for (int i = 0; i < Hwb.Count; i++)
            //Sheets += "\n" + Hwb.GetSheetAt(i).SheetName;
            sb.AppendLine(Hwb.GetSheetAt(i).SheetName);
        break;
    case XLSType.XLSX:
        for (int i = 0; i < Xwb.Count; i++)
            //Sheets += "\n" + Xwb.GetSheetAt(i).SheetName;
            sb.AppendLine(Xwb.GetSheetAt(i).SheetName);
        break;
    default:
        break;
}

Sheets = sb.ToString();
It should be obvious, but note that this code is not tested.
«Tell me and I forget. Teach me and I remember. Involve me and I learn.» Benjamin Franklin

GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Eddy Vluggen23-Dec-15 6:34
professionalEddy Vluggen23-Dec-15 6:34 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
BillWoodruff23-Dec-15 19:44
professionalBillWoodruff23-Dec-15 19:44 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Eddy Vluggen24-Dec-15 1:30
professionalEddy Vluggen24-Dec-15 1:30 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin24-Dec-15 9:51
Emanuele Bonin24-Dec-15 9:51 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin24-Dec-15 9:58
Emanuele Bonin24-Dec-15 9:58 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin24-Dec-15 9:55
Emanuele Bonin24-Dec-15 9:55 
AnswerRe: Is there a better way to call Same Methods on different objects ? Pin
Gerry Schmitz24-Dec-15 8:11
mveGerry Schmitz24-Dec-15 8:11 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin26-Dec-15 5:28
Emanuele Bonin26-Dec-15 5:28 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Gerry Schmitz26-Dec-15 7:43
mveGerry Schmitz26-Dec-15 7:43 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin26-Dec-15 8:40
Emanuele Bonin26-Dec-15 8:40 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Gerry Schmitz26-Dec-15 16:16
mveGerry Schmitz26-Dec-15 16:16 
QuestionFill DataGrid ODBC Postgres Pin
Andre Dieme22-Dec-15 23:04
Andre Dieme22-Dec-15 23:04 
AnswerRe: Fill DataGrid ODBC Postgres Pin
Eddy Vluggen23-Dec-15 1:51
professionalEddy Vluggen23-Dec-15 1:51 
AnswerRe: Fill DataGrid ODBC Postgres Pin
Mycroft Holmes23-Dec-15 11:53
professionalMycroft Holmes23-Dec-15 11:53 
GeneralRe: Fill DataGrid ODBC Postgres Pin
Andre Dieme25-Dec-15 10:31
Andre Dieme25-Dec-15 10:31 
QuestionWhy i can't change my startup Form in VS2013. Pin
Kashaf Murtaza22-Dec-15 22:18
Kashaf Murtaza22-Dec-15 22:18 
AnswerRe: Why i can't change my startup Form in VS2013. Pin
Pete O'Hanlon22-Dec-15 23:35
mvePete O'Hanlon22-Dec-15 23:35 

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.