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

C#

 
AnswerRe: Issue with Release Version Exe Pin
Bernhard Hiller24-Mar-11 22:41
Bernhard Hiller24-Mar-11 22:41 
QuestionString format for MAC-address Pin
Mc_Topaz24-Mar-11 4:22
Mc_Topaz24-Mar-11 4:22 
AnswerRe: String format for MAC-address Pin
Luc Pattyn24-Mar-11 4:37
sitebuilderLuc Pattyn24-Mar-11 4:37 
AnswerRe: String format for MAC-address Pin
J4amieC24-Mar-11 5:38
J4amieC24-Mar-11 5:38 
AnswerRe: String format for MAC-address Pin
Richard MacCutchan24-Mar-11 5:53
mveRichard MacCutchan24-Mar-11 5:53 
AnswerRe: String format for MAC-address PinPopular
musefan24-Mar-11 6:56
musefan24-Mar-11 6:56 
AnswerRe: String format for MAC-address Pin
Ennis Ray Lynch, Jr.24-Mar-11 7:54
Ennis Ray Lynch, Jr.24-Mar-11 7:54 
AnswerRe: String format for MAC-address PinPopular
#realJSOP24-Mar-11 9:31
mve#realJSOP24-Mar-11 9:31 
C#
mac2 = string.Format("{0:x2}-{1:x2}-{2:x2}-{3:x2}-{4:x2}-{5:x2}", 
                     mac1.Substring(0,2), 
                     mac1.Substring(2,2),
                     mac1.Substring(4,2),
                     mac1.Substring(6,2),
                     mac1.Substring(8,2),
                     mac1.Substring(10,2));


or

C#
StringBuilder mac2 = new StringBuilder();
mac2.AppendFormat("{0:x2}", mac1.Substring(0,2));
mac2.AppendFormat("{0:x2}", mac1.Substring(2,2));
mac2.AppendFormat("{0:x2}", mac1.Substring(4,2));
mac2.AppendFormat("{0:x2}", mac1.Substring(6,2));
mac2.AppendFormat("{0:x2}", mac1.Substring(8,2));
mac2.AppendFormat("{0:x2}", mac1.Substring(10,2));


or

C#
string mac2 = "";
for (int i = 0; i < mac1.Length; i++)
{
    mac2 += mac1[i];
    if ((i + 1) % 2 == 0 && i < mac1.Length-1)
    {
        mac2 += "-";
    }
}


I'm sure there are other ways, and pretty much anything you come up with can be turned into an extension method.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997


AnswerRe: String format for MAC-address PinPopular
#realJSOP24-Mar-11 9:58
mve#realJSOP24-Mar-11 9:58 
GeneralRe: String format for MAC-address Pin
HimanshuJoshi24-Mar-11 10:04
HimanshuJoshi24-Mar-11 10:04 
GeneralRe: String format for MAC-address Pin
fjdiewornncalwe25-Mar-11 2:55
professionalfjdiewornncalwe25-Mar-11 2:55 
QuestionControl forms of an app Pin
dj_jeff24-Mar-11 3:43
dj_jeff24-Mar-11 3:43 
AnswerRe: Control forms of an app Pin
BobJanova24-Mar-11 5:23
BobJanova24-Mar-11 5:23 
AnswerRe: Control forms of an app Pin
Nitheesh George24-Mar-11 20:30
Nitheesh George24-Mar-11 20:30 
GeneralRe: Control forms of an app Pin
dj_jeff24-Mar-11 21:28
dj_jeff24-Mar-11 21:28 
GeneralRe: Control forms of an app Pin
Nitheesh George24-Mar-11 22:45
Nitheesh George24-Mar-11 22:45 
GeneralRe: Control forms of an app Pin
dj_jeff25-Mar-11 0:11
dj_jeff25-Mar-11 0:11 
QuestionDatagridviewcomboboxcolumn SelectedIndexChanged not work properly Pin
Davey_guan24-Mar-11 3:34
Davey_guan24-Mar-11 3:34 
AnswerRe: Datagridviewcomboboxcolumn SelectedIndexChanged not work properly Pin
Henry Minute24-Mar-11 17:12
Henry Minute24-Mar-11 17:12 
GeneralRe: Datagridviewcomboboxcolumn SelectedIndexChanged not work properly Pin
Davey_guan25-Mar-11 19:48
Davey_guan25-Mar-11 19:48 
GeneralRe: Datagridviewcomboboxcolumn SelectedIndexChanged not work properly Pin
Henry Minute26-Mar-11 5:03
Henry Minute26-Mar-11 5:03 
GeneralRe: Datagridviewcomboboxcolumn SelectedIndexChanged not work properly Pin
Davey_guan26-Mar-11 20:01
Davey_guan26-Mar-11 20:01 
GeneralRe: Datagridviewcomboboxcolumn SelectedIndexChanged not work properly Pin
Henry Minute26-Mar-11 5:40
Henry Minute26-Mar-11 5:40 
Questionneed help in c# coding Pin
ULKA RAMAKRISHNAN24-Mar-11 2:16
ULKA RAMAKRISHNAN24-Mar-11 2:16 
AnswerRe: need help in c# coding Pin
Ravi Bhavnani24-Mar-11 2:19
professionalRavi Bhavnani24-Mar-11 2:19 

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.