Click here to Skip to main content
16,007,610 members
Home / Discussions / C#
   

C#

 
Generalusing OR in switch case statements Pin
liptonIcedTea6-Mar-08 18:15
liptonIcedTea6-Mar-08 18:15 
GeneralRe: using OR in switch case statements Pin
Christian Graus6-Mar-08 18:31
protectorChristian Graus6-Mar-08 18:31 
GeneralRe: using OR in switch case statements Pin
mav.northwind6-Mar-08 19:01
mav.northwind6-Mar-08 19:01 
GeneralRe: using OR in switch case statements Pin
PIEBALDconsult7-Mar-08 6:01
mvePIEBALDconsult7-Mar-08 6:01 
QuestionDrawing on a tabPage Pin
Roger CS6-Mar-08 17:58
Roger CS6-Mar-08 17:58 
GeneralRe: Drawing on a tabPage Pin
Christian Graus6-Mar-08 18:34
protectorChristian Graus6-Mar-08 18:34 
GeneralRe: Drawing on a tabPage Pin
Ajay.k_Singh6-Mar-08 19:00
Ajay.k_Singh6-Mar-08 19:00 
GeneralRecommended placement of Main() Pin
Eric Cook6-Mar-08 17:51
Eric Cook6-Mar-08 17:51 
I've been programming C# for a couple years now in the academic setting, but I've been curious about the recommended place to put Main() in a Windows Forms application. I know of two ways to do it. One is to simply place Main() in the same class as the primary form, as below:
using System;
using System.Windows.Forms;
namespace TestCode
{
   public class MyForm : Form
   {
      public static void Main(String[] args)
      {
         Application.Run(new MyForm());
      }
   }
}


The other method is to create a separate class and put Main() in there, as below:
using System;
using System.Windows.Forms;
namespace TestCode
{
   public class MyForm : Form
   {
      // Some code here
   }

   public class MyApp
   {
      public static void Main(String[] args)
      {
         Application.Run(new MyForm());
      }
   }
}


I've found that most people use the first method, but the second method seems better to me because it keeps the application logic and whatnot out of the GUI code. Are either of these two the "better" option? Or is it merely a matter of preference?

Thanks.
GeneralRe: Recommended placement of Main() Pin
Christian Graus6-Mar-08 17:53
protectorChristian Graus6-Mar-08 17:53 
JokeRe: Recommended placement of Main() Pin
PIEBALDconsult7-Mar-08 5:43
mvePIEBALDconsult7-Mar-08 5:43 
QuestionHow to drag & drop shape drawn by GDI+ in picture box area? Pin
yuenli6-Mar-08 16:05
yuenli6-Mar-08 16:05 
GeneralRe: How to drag & drop shape drawn by GDI+ in picture box area? Pin
Christian Graus6-Mar-08 17:25
protectorChristian Graus6-Mar-08 17:25 
GeneralRe: How to drag & drop shape drawn by GDI+ in picture box area? Pin
yuenli6-Mar-08 18:25
yuenli6-Mar-08 18:25 
GeneralRe: How to drag & drop shape drawn by GDI+ in picture box area? Pin
Christian Graus6-Mar-08 18:33
protectorChristian Graus6-Mar-08 18:33 
GeneralRe: How to drag & drop shape drawn by GDI+ in picture box area? Pin
yuenli6-Mar-08 18:43
yuenli6-Mar-08 18:43 
GeneralRe: How to drag & drop shape drawn by GDI+ in picture box area? Pin
Christian Graus6-Mar-08 18:47
protectorChristian Graus6-Mar-08 18:47 
GeneralRe: How to drag & drop shape drawn by GDI+ in picture box area? Pin
yuenli6-Mar-08 18:54
yuenli6-Mar-08 18:54 
GeneralRe: How to drag & drop shape drawn by GDI+ in picture box area? Pin
Christian Graus6-Mar-08 20:54
protectorChristian Graus6-Mar-08 20:54 
GeneralRe: How to drag & drop shape drawn by GDI+ in picture box area? Pin
yuenli8-Mar-08 4:25
yuenli8-Mar-08 4:25 
GeneralOleDb Jet UpdateCommand Pin
jharker19876-Mar-08 15:30
jharker19876-Mar-08 15:30 
GeneralRe: OleDb Jet UpdateCommand Pin
PIEBALDconsult6-Mar-08 16:39
mvePIEBALDconsult6-Mar-08 16:39 
GeneralRe: OleDb Jet UpdateCommand Pin
jharker19877-Mar-08 1:11
jharker19877-Mar-08 1:11 
GeneralRe: OleDb Jet UpdateCommand Pin
PIEBALDconsult7-Mar-08 5:44
mvePIEBALDconsult7-Mar-08 5:44 
GeneralRe: OleDb Jet UpdateCommand Pin
KaptinKrunch6-Mar-08 16:46
KaptinKrunch6-Mar-08 16:46 
GeneralPump wait message while accessing data Pin
MAW306-Mar-08 15:14
MAW306-Mar-08 15:14 

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.