Click here to Skip to main content
15,910,118 members
Home / Discussions / C#
   

C#

 
QuestionIs there a way to consolidate this? Pin
Blubbo16-Jun-06 6:47
Blubbo16-Jun-06 6:47 
AnswerRe: Is there a way to consolidate this? Pin
Dustin Metzgar16-Jun-06 7:09
Dustin Metzgar16-Jun-06 7:09 
GeneralRe: Is there a way to consolidate this? Pin
RonBou16-Jun-06 7:19
RonBou16-Jun-06 7:19 
GeneralRe: Is there a way to consolidate this? Pin
RonBou16-Jun-06 7:33
RonBou16-Jun-06 7:33 
GeneralRe: Is there a way to consolidate this? Pin
Guffa16-Jun-06 8:41
Guffa16-Jun-06 8:41 
GeneralRe: Is there a way to consolidate this? [modified] Pin
Robert Rohde16-Jun-06 9:32
Robert Rohde16-Jun-06 9:32 
GeneralRe: Is there a way to consolidate this? [modified] Pin
Blubbo16-Jun-06 9:48
Blubbo16-Jun-06 9:48 
GeneralRe: Is there a way to consolidate this? Pin
Guffa16-Jun-06 10:07
Guffa16-Jun-06 10:07 
Robert Rohde wrote:
Just noticed that replacing the 4 Control fields with one array could safe another 6 lines but that would probably look a bit ugly.


Or perhaps even replace the entire struct with an array? Smile | :)

//somewhere in the constructor
cbMathA.Tag = new Control() {numericUpDownAL, numericUpDownAR, dateTimePickerAL, dateTimePickerAR};
cbMathB.Tag = new Control() {numericUpDownBL, numericUpDownBR, dateTimePickerBL, dateTimePickerBR};
cbMathC.Tag = new Control() {numericUpDownCL, numericUpDownCR, dateTimePickerCL, dateTimePickerCR};
cbMathD.Tag = new Control() {numericUpDownDL, numericUpDownDR, dateTimePickerDL, dateTimePickerDR};
cbMathE.Tag = new Control() {numericUpDownEL, numericUpDownER, dateTimePickerEL, dateTimePickerER};
cbMathF.Tag = new Control() {numericUpDownFL, numericUpDownFR, dateTimePickerFL, dateTimePickerFR};
cbMathG.Tag = new Control() {numericUpDownGL, numericUpDownGR, dateTimePickerGL, dateTimePickerGR};
cbMathH.Tag = new Control() {numericUpDownHL, numericUpDownHR, dateTimePickerHL, dateTimePickerHR};

private void cbMath_IndexChanged(object sender, System.EventArgs e) {
   Control() info = (Control())((ComboBox)sender).Tag;
   info(1).Visible = (info(0).Visible && ((ComboBox)sender).Text == "Range");
   info(3).Visible = (info(2).Visible && ((ComboBox)sender).Text == "Range");
}


And, yes, readability and extremely short code doesn't play well together. Wink | ;)


---
b { font-weight: normal; }

GeneralRe: Is there a way to consolidate this? Pin
Robert Rohde16-Jun-06 10:21
Robert Rohde16-Jun-06 10:21 
QuestionMAC Address Pin
moro14516-Jun-06 6:40
moro14516-Jun-06 6:40 
AnswerRe: MAC Address [modified] Pin
Ravi Bhavnani16-Jun-06 6:52
professionalRavi Bhavnani16-Jun-06 6:52 
GeneralRe: MAC Address Pin
moro14516-Jun-06 8:17
moro14516-Jun-06 8:17 
AnswerRe: MAC Address Pin
Ravi Bhavnani16-Jun-06 8:25
professionalRavi Bhavnani16-Jun-06 8:25 
GeneralRe: MAC Address Pin
moro14516-Jun-06 9:48
moro14516-Jun-06 9:48 
AnswerRe: MAC Address Pin
Ravi Bhavnani16-Jun-06 9:55
professionalRavi Bhavnani16-Jun-06 9:55 
GeneralRe: MAC Address Pin
moro14516-Jun-06 10:23
moro14516-Jun-06 10:23 
AnswerRe: MAC Address Pin
bob1697216-Jun-06 6:56
bob1697216-Jun-06 6:56 
GeneralRe: MAC Address Pin
moro14516-Jun-06 8:12
moro14516-Jun-06 8:12 
GeneralRe: MAC Address Pin
bob1697216-Jun-06 9:28
bob1697216-Jun-06 9:28 
GeneralRe: MAC Address Pin
moro14516-Jun-06 9:57
moro14516-Jun-06 9:57 
Questioncustom shapes buttons Pin
relsirc16-Jun-06 6:35
relsirc16-Jun-06 6:35 
AnswerRe: custom shapes buttons Pin
Ravi Bhavnani16-Jun-06 6:57
professionalRavi Bhavnani16-Jun-06 6:57 
AnswerRe: custom shapes buttons Pin
Jun Du16-Jun-06 7:23
Jun Du16-Jun-06 7:23 
QuestionConnecting to HyperTerminal or allowing c# to run a program Pin
keroed_edmond16-Jun-06 6:28
keroed_edmond16-Jun-06 6:28 
AnswerRe: Connecting to HyperTerminal or allowing c# to run a program Pin
moro14516-Jun-06 8:24
moro14516-Jun-06 8:24 

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.