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

C#

 
GeneralRe: Application service with C#. Pin
Member 1401973516-Oct-18 22:09
Member 1401973516-Oct-18 22:09 
GeneralRe: Application service with C#. Pin
OriginalGriff16-Oct-18 22:13
mveOriginalGriff16-Oct-18 22:13 
GeneralRe: Application service with C#. Pin
Member 1401973516-Oct-18 22:46
Member 1401973516-Oct-18 22:46 
GeneralRe: Application service with C#. Pin
OriginalGriff16-Oct-18 23:02
mveOriginalGriff16-Oct-18 23:02 
GeneralRe: Application service with C#. Pin
Pete O'Hanlon16-Oct-18 23:59
mvePete O'Hanlon16-Oct-18 23:59 
AnswerRe: Application service with C#. Pin
#realJSOP22-Oct-18 9:03
professional#realJSOP22-Oct-18 9:03 
QuestionHow can I make my code modular? Pin
George Bradley16-Oct-18 12:43
George Bradley16-Oct-18 12:43 
AnswerRe: How can I make my code modular? Pin
V.16-Oct-18 18:44
professionalV.16-Oct-18 18:44 
Start by creating a seperate class (seperate from your GUI class) and pass the necessary data for the algortihm via or the constructor or via properties (or both).

The GUI should handle data validation input. Perhaps make the calculation buttons only available if the data is valid.

When the algorithm is finished it returns the result to the GUI who can display it.

Small pseudocode example.
//GUI class
function calculate(){
  int n1, n2;
  bool parse1 = int.TryParse(txt1.Text, out n1);
  bool parse2 = int.TryParse(txt2.Text, out n2);
  if(parse1 && parse2){
    Calculator calc = new Calculator();
    txt_sum.Text = calc.Add(n1, n2);
    txt_substract.Text = calc.Substract(n1, n2);
  }
}

//Calculator class

function Add(int n1, int n2){
  return n1 + n2;
}

function Substract(int n1, int n2){
  return n1 - n2;
}

Of course this is a very quick and dirty pseudo code example, you'll need to work the rest out from there.

PS: If you want to do it properly move the calculations to some form of a business layer instead of just a seperate class.

Hope this helps.
V.

GeneralRe: How can I make my code modular? Pin
henrydevid127-Oct-18 11:56
henrydevid127-Oct-18 11:56 
AnswerRe: How can I make my code modular? Pin
#realJSOP24-Oct-18 1:42
professional#realJSOP24-Oct-18 1:42 
AnswerRe: How can I make my code modular? Pin
josda100026-Oct-18 18:29
josda100026-Oct-18 18:29 
GeneralRe: How can I make my code modular? Pin
josda100027-Oct-18 2:48
josda100027-Oct-18 2:48 
QuestionImagelist in Tabcontrol - Image selection Pin
RAFENS15-Oct-18 23:47
RAFENS15-Oct-18 23:47 
AnswerRe: Imagelist in Tabcontrol - Image selection Pin
BillWoodruff19-Oct-18 2:49
professionalBillWoodruff19-Oct-18 2:49 
QuestionImage processing in c# Pin
Member 1401942314-Oct-18 10:51
Member 1401942314-Oct-18 10:51 
AnswerRe: Image processing in c# Pin
Dave Kreskowiak14-Oct-18 11:56
mveDave Kreskowiak14-Oct-18 11:56 
GeneralRe: Image processing in c# Pin
Member 1401942314-Oct-18 14:44
Member 1401942314-Oct-18 14:44 
GeneralRe: Image processing in c# Pin
Dave Kreskowiak14-Oct-18 18:28
mveDave Kreskowiak14-Oct-18 18:28 
QuestionUploading images to web hosting server (a particular folder like "Images") through C#.NET Pin
PKSubudhi13-Oct-18 17:47
PKSubudhi13-Oct-18 17:47 
AnswerRe: Uploading images to web hosting server (a particular folder like "Images") through C#.NET Pin
OriginalGriff13-Oct-18 19:56
mveOriginalGriff13-Oct-18 19:56 
AnswerRe: Uploading images to web hosting server (a particular folder like "Images") through C#.NET Pin
Mycroft Holmes14-Oct-18 13:04
professionalMycroft Holmes14-Oct-18 13:04 
QuestionHow can we send SMS in C#.NET to any mobile number without API Gateway? Pin
PKSubudhi13-Oct-18 19:53
PKSubudhi13-Oct-18 19:53 
AnswerRe: How can we send SMS in C#.NET to any mobile number without API Gateway? Pin
Richard MacCutchan13-Oct-18 21:24
mveRichard MacCutchan13-Oct-18 21:24 
AnswerRe: How can we send SMS in C#.NET to any mobile number without API Gateway? Pin
Dave Kreskowiak14-Oct-18 4:53
mveDave Kreskowiak14-Oct-18 4:53 
AnswerRe: How can we send SMS in C#.NET to any mobile number without API Gateway? Pin
MadMyche15-Oct-18 6:25
professionalMadMyche15-Oct-18 6:25 

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.