Click here to Skip to main content
15,899,825 members
Home / Discussions / C#
   

C#

 
AnswerRe: Memory Leak in WPF. Multiple instances of the same control in memory. Pin
Saksida Bojan19-Feb-10 20:21
Saksida Bojan19-Feb-10 20:21 
Questiongrid view row copy Pin
Syed Shahid Hussain18-Feb-10 23:01
Syed Shahid Hussain18-Feb-10 23:01 
AnswerRe: grid view row copy Pin
Saksida Bojan19-Feb-10 20:14
Saksida Bojan19-Feb-10 20:14 
QuestionDatagridViewColumn displayIndex - column order wrong after setting them from control settings table. Pin
PoppysDad18-Feb-10 22:48
PoppysDad18-Feb-10 22:48 
AnswerRe: DatagridViewColumn displayIndex - column order wrong after setting them from control settings table. Pin
Vishal Bhatt115-Sep-10 22:58
Vishal Bhatt115-Sep-10 22:58 
AnswerRe: DatagridViewColumn displayIndex - column order wrong after setting them from control settings table. Pin
Zombie_Inc18-Nov-10 20:24
Zombie_Inc18-Nov-10 20:24 
GeneralRe: DatagridViewColumn displayIndex - column order wrong after setting them from control settings table. Pin
henhao8-May-11 7:23
henhao8-May-11 7:23 
QuestionHow to check if Excel-workbook is empty? Pin
Thomas ST18-Feb-10 22:28
Thomas ST18-Feb-10 22:28 
I'm trying to write a method to find out if a workbook is empty or not..
I'm using Excel 2007 and Microsoft.Office.Interop.Excel.Workbook.
If the workbook has content in more than one cell I'm able to detect this, but if I have an empty "workbookA" and a "workbookB" with content in cell A1 I'm not able to seperate these..

Does anyone have a hot tip? (It's hard to find anything on excel-automation on google..)

private bool IsWorkbookEmpty(Workbook excelBook)
{
    try
    {
        if (excelBook.Sheets.Count <= 0)
        {
            return true;
        }
        else
        {
            foreach (Worksheet sheet in excelBook.Sheets)
            {
                Range excelRange = sheet.UsedRange;
                int test1 = excelRange.Columns.Count;
                int test2 = excelRange.Rows.Count;
                int test3 = excelRange.Count;

                if (test1 > 1 || test2 > 1 || test3 > 1)
                {
                    return false;
                }
                else //look for content..
                {
                    foreach(Range cell in excelRange)
                    {
                        object test5 = cell.FormulaR1C1;
                        object test6 = cell.get_Value(Type.Missing);
                        //How do I check if cell has content?
                        //return true; if cell has content..
                    }
                }
            }
        }
    }
    catch (Exception)
    {
        return false;
    }
    return true;
}    

AnswerRe: How to check if Excel-workbook is empty? Pin
Thomas ST18-Feb-10 22:41
Thomas ST18-Feb-10 22:41 
GeneralRe: How to check if Excel-workbook is empty? Pin
Member 766206128-Feb-11 21:40
Member 766206128-Feb-11 21:40 
QuestionTemporary Modification in a Control During Drag and Drop Pin
Som Shekhar18-Feb-10 22:11
Som Shekhar18-Feb-10 22:11 
AnswerRe: Temporary Modification in a Control During Drag and Drop Pin
Luc Pattyn19-Feb-10 0:26
sitebuilderLuc Pattyn19-Feb-10 0:26 
GeneralRe: Temporary Modification in a Control During Drag and Drop Pin
Som Shekhar19-Feb-10 0:35
Som Shekhar19-Feb-10 0:35 
Questionproject using c#.net and sql server 2005 Pin
savitha87k18-Feb-10 20:37
savitha87k18-Feb-10 20:37 
AnswerRe: project using c#.net and sql server 2005 Pin
Saksida Bojan18-Feb-10 20:48
Saksida Bojan18-Feb-10 20:48 
QuestionHow to delete duplicate nodes from XML throgh C# Pin
deadlyabbas18-Feb-10 18:41
deadlyabbas18-Feb-10 18:41 
AnswerRe: How to delete duplicate nodes from XML throgh C# Pin
Saksida Bojan18-Feb-10 20:46
Saksida Bojan18-Feb-10 20:46 
QuestionSelect a HostName with Regex in C# ? Pin
Mohammad Dayyan18-Feb-10 17:19
Mohammad Dayyan18-Feb-10 17:19 
AnswerRe: Select a HostName with Regex in C# ? Pin
tonyonlinux18-Feb-10 18:05
tonyonlinux18-Feb-10 18:05 
GeneralRe: Select a HostName with Regex in C# ? Pin
Mohammad Dayyan18-Feb-10 21:55
Mohammad Dayyan18-Feb-10 21:55 
GeneralRe: Select a HostName with Regex in C# ? Pin
AspDotNetDev18-Feb-10 23:01
protectorAspDotNetDev18-Feb-10 23:01 
GeneralRe: Select a HostName with Regex in C# ? Pin
Mohammad Dayyan19-Feb-10 2:13
Mohammad Dayyan19-Feb-10 2:13 
AnswerRe: Select a HostName with Regex in C# ? Pin
AspDotNetDev18-Feb-10 20:17
protectorAspDotNetDev18-Feb-10 20:17 
GeneralRe: Select a HostName with Regex in C# ? Pin
OriginalGriff18-Feb-10 21:41
mveOriginalGriff18-Feb-10 21:41 
GeneralRe: Select a HostName with Regex in C# ? Pin
Gaurav Dudeja India18-Feb-10 21:43
Gaurav Dudeja India18-Feb-10 21:43 

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.