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

C#

 
AnswerRe: About Luhn Algorithm Pin
Pete O'Hanlon3-Oct-19 1:53
mvePete O'Hanlon3-Oct-19 1:53 
AnswerRe: About Luhn Algorithm Pin
Dave Kreskowiak3-Oct-19 1:57
mveDave Kreskowiak3-Oct-19 1:57 
AnswerRe: About Luhn Algorithm Pin
OriginalGriff3-Oct-19 4:04
mveOriginalGriff3-Oct-19 4:04 
AnswerRe: About Luhn Algorithm Pin
CPallini3-Oct-19 7:55
mveCPallini3-Oct-19 7:55 
AnswerRe: About Luhn Algorithm Pin
Kevin Marois4-Oct-19 7:27
professionalKevin Marois4-Oct-19 7:27 
QuestionGet constant from column ordinal. Pin
MAW3030-Sep-19 8:47
MAW3030-Sep-19 8:47 
AnswerRe: Get constant from column ordinal. Pin
Richard MacCutchan30-Sep-19 9:17
mveRichard MacCutchan30-Sep-19 9:17 
AnswerRe: Get constant from column ordinal. Pin
BillWoodruff30-Sep-19 23:37
professionalBillWoodruff30-Sep-19 23:37 
See if this gives you useful ideas:
public class SwitchOnDTOrdinal
{
    public SwitchOnDTOrdinal(DataTable table)
    {
        TheTable =  table;

        validColumnNames = table.Columns
            .Cast<DataColumn>()
            .Select(col => col.ColumnName)
            .ToList();
    }

    private List<string> validColumnNames;

    private DataTable TheTable;

    public void SwitchA(string cname)
    {
        if (! validColumnNames.Contains(cname))
        {
            throw new ArgumentException(@"{cname} is not a valid column name");
        }

        switch(TheTable.Columns[cname].Ordinal)
        {
            case 0:
                break;
            case 1:
                break;
            case 2:
                break;
            case 3:
                break;
            default:
                throw new ArgumentOutOfRangeException();
        }
    }
}

«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali


modified 1-Oct-19 6:48am.

AnswerRe: Get constant from column ordinal. Pin
Luc Pattyn1-Oct-19 3:55
sitebuilderLuc Pattyn1-Oct-19 3:55 
QuestionUpload encrypted excel file to datagridview Pin
HoaiNTT061029-Sep-19 22:48
HoaiNTT061029-Sep-19 22:48 
QuestionRe: Upload encrypted excel file to datagridview Pin
Richard MacCutchan29-Sep-19 22:51
mveRichard MacCutchan29-Sep-19 22:51 
JokeRe: Upload encrypted excel file to datagridview Pin
dan!sh 29-Sep-19 23:06
professional dan!sh 29-Sep-19 23:06 
AnswerRe: Upload encrypted excel file to datagridview Pin
OriginalGriff30-Sep-19 1:30
mveOriginalGriff30-Sep-19 1:30 
QuestionCould Not Decrease right of Non Client in Edit Control Pin
Member 1180360726-Sep-19 6:33
Member 1180360726-Sep-19 6:33 
AnswerRe: Could Not Decrease right of Non Client in Edit Control Pin
Richard MacCutchan26-Sep-19 6:42
mveRichard MacCutchan26-Sep-19 6:42 
AnswerRe: Could Not Decrease right of Non Client in Edit Control Pin
Dave Kreskowiak26-Sep-19 10:23
mveDave Kreskowiak26-Sep-19 10:23 
GeneralRe: Could Not Decrease right of Non Client in Edit Control Pin
Member 1180360726-Sep-19 21:54
Member 1180360726-Sep-19 21:54 
AnswerRe: Could Not Decrease right of Non Client in Edit Control Pin
OriginalGriff26-Sep-19 23:38
mveOriginalGriff26-Sep-19 23:38 
Question[VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661326-Sep-19 5:03
professionalsteve_949661326-Sep-19 5:03 
AnswerRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP26-Sep-19 5:46
mve#realJSOP26-Sep-19 5:46 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661326-Sep-19 20:47
professionalsteve_949661326-Sep-19 20:47 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP26-Sep-19 22:53
mve#realJSOP26-Sep-19 22:53 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
dan!sh 27-Sep-19 1:09
professional dan!sh 27-Sep-19 1:09 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP27-Sep-19 5:45
mve#realJSOP27-Sep-19 5:45 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661329-Sep-19 20:48
professionalsteve_949661329-Sep-19 20:48 

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.