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

C#

 
AnswerRe: "sendkeys" does not work KnightOnline Pin
Dave Kreskowiak31-Dec-12 3:28
mveDave Kreskowiak31-Dec-12 3:28 
GeneralRe: "sendkeys" does not work KnightOnline Pin
ismail2031-Dec-12 3:42
ismail2031-Dec-12 3:42 
GeneralRe: "sendkeys" does not work KnightOnline Pin
Dave Kreskowiak31-Dec-12 5:38
mveDave Kreskowiak31-Dec-12 5:38 
GeneralRe: "sendkeys" does not work KnightOnline Pin
ismail2031-Dec-12 6:30
ismail2031-Dec-12 6:30 
GeneralRe: "sendkeys" does not work KnightOnline Pin
Dave Kreskowiak31-Dec-12 6:47
mveDave Kreskowiak31-Dec-12 6:47 
GeneralRe: "sendkeys" does not work KnightOnline Pin
ismail2031-Dec-12 7:35
ismail2031-Dec-12 7:35 
GeneralRe: "sendkeys" does not work KnightOnline Pin
fjdiewornncalwe31-Dec-12 7:53
professionalfjdiewornncalwe31-Dec-12 7:53 
GeneralRe: "sendkeys" does not work KnightOnline Pin
Dave Kreskowiak31-Dec-12 7:59
mveDave Kreskowiak31-Dec-12 7:59 
GeneralRe: "sendkeys" does not work KnightOnline Pin
Pete O'Hanlon31-Dec-12 9:01
mvePete O'Hanlon31-Dec-12 9:01 
GeneralRe: "sendkeys" does not work KnightOnline Pin
harold aptroot31-Dec-12 12:40
harold aptroot31-Dec-12 12:40 
AnswerRe: "sendkeys" does not work KnightOnline Pin
Abhinav S1-Jan-13 4:38
Abhinav S1-Jan-13 4:38 
AnswerRe: "sendkeys" does not work KnightOnline Pin
Thomas Daniels1-Jan-13 5:52
mentorThomas Daniels1-Jan-13 5:52 
AnswerIt's a game :) Pin
Eddy Vluggen1-Jan-13 6:01
professionalEddy Vluggen1-Jan-13 6:01 
GeneralRe: It's a game :) Pin
Thomas Daniels1-Jan-13 6:05
mentorThomas Daniels1-Jan-13 6:05 
Generalto access latitudes and longitudes from database Pin
naveen 201230-Dec-12 22:28
naveen 201230-Dec-12 22:28 
GeneralRe: to access latitudes and longitudes from database Pin
OriginalGriff30-Dec-12 23:22
mveOriginalGriff30-Dec-12 23:22 
GeneralRe: to access latitudes and longitudes from database Pin
Pete O'Hanlon30-Dec-12 23:54
mvePete O'Hanlon30-Dec-12 23:54 
GeneralRe: to access latitudes and longitudes from database Pin
Ennis Ray Lynch, Jr.31-Dec-12 5:36
Ennis Ray Lynch, Jr.31-Dec-12 5:36 
GeneralRe: to access latitudes and longitudes from database Pin
PIEBALDconsult31-Dec-12 6:22
mvePIEBALDconsult31-Dec-12 6:22 
Questionhow to extract tag in regular expressions c# Pin
ngoanrazor30-Dec-12 5:02
ngoanrazor30-Dec-12 5:02 
AnswerRe: how to extract tag in regular expressions c# Pin
PIEBALDconsult30-Dec-12 5:39
mvePIEBALDconsult30-Dec-12 5:39 
GeneralRe: how to extract tag in regular expressions c# Pin
OriginalGriff30-Dec-12 21:20
mveOriginalGriff30-Dec-12 21:20 
GeneralRe: how to extract tag in regular expressions c# Pin
Brisingr Aerowing31-Dec-12 12:16
professionalBrisingr Aerowing31-Dec-12 12:16 
GeneralRe: how to extract tag in regular expressions c# Pin
PIEBALDconsult31-Dec-12 12:24
mvePIEBALDconsult31-Dec-12 12:24 
QuestionBoolean function to return true/false Pin
Member 970415330-Dec-12 2:57
Member 970415330-Dec-12 2:57 
I have the following function which I got online, and have changed to suit my needs :-

private Boolean SheetExists(string strFilename)
{
    Boolean Match = false;
    OleDbConnection objConn = null;
    System.Data.DataTable dt = null;
    try
    {
        String connString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
            "Data Source=" + strFilename + ";Extended Properties=Excel 8.0;";
        objConn = new OleDbConnection(connString);
        objConn.Open();
        dt = objConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
        String[] excelSheets = new String[dt.Rows.Count];
        int i = 0;
        foreach (DataRow row in dt.Rows)
        {
            excelSheets[i] = row["TABLE_NAME"].ToString();
            i++;
        }
        for (int j = 0; j < excelSheets.Length; j++)
        {
            if (excelSheets[j] == "Sheet1$")
            {
                Match = true;
            }
        }
        if (Match == true)
            return true;
        else
            return false;
    }
    finally
    {
        if (objConn != null)
        {
            objConn.Close();
            objConn.Dispose();
        }
        if (dt != null)
        {
            dt.Dispose();
        }
    }
}


Basically it checks if sheet1 exists in a workbook. I'm currently using the variable "Match" to obtain a "return true" or a "return false". I'm sure it possible to modify the code so that it returns the true/false directly, I just can't figure out how.
Any ideas? Thanks

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.