Click here to Skip to main content
15,907,906 members
Home / Discussions / C#
   

C#

 
QuestionDatagrid doesn't show data [modified] Pin
ircnoob8-Aug-06 14:25
ircnoob8-Aug-06 14:25 
AnswerRe: Datagrid doesn't show data Pin
gkl08188-Aug-06 15:17
gkl08188-Aug-06 15:17 
GeneralRe: Datagrid doesn't show data Pin
ircnoob8-Aug-06 15:28
ircnoob8-Aug-06 15:28 
AnswerRe: Datagrid doesn't show data Pin
ircnoob8-Aug-06 23:14
ircnoob8-Aug-06 23:14 
Questionusing separate codefiles Pin
Glen Harvy8-Aug-06 14:22
Glen Harvy8-Aug-06 14:22 
AnswerRe: using separate codefiles Pin
Leslie Sanford8-Aug-06 16:26
Leslie Sanford8-Aug-06 16:26 
GeneralRe: using separate codefiles Pin
Glen Harvy8-Aug-06 18:39
Glen Harvy8-Aug-06 18:39 
GeneralRe: using separate codefiles Pin
Leslie Sanford8-Aug-06 19:05
Leslie Sanford8-Aug-06 19:05 
Glen Harvy wrote:
string ext = (string) a.getYMDHMS();


No need for a cast.

Glen Harvy wrote:
but I also note that making the namespace AND the class the same in both files I can do away with the following


So you changed the extension class to this?

namespace myclubv2
{
    public class MainForm
    {
        public string getYMDHMS()
        {
            // ...
        }
    }
}


And in your mainform.cs file, you have something like this?

namespace myclubv2
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent(); 
            
            string ext = (string) a.getYMDHMS();
            MessageBox.Show("YMDHmS is " + ext);
        }
    }
}


Glen Harvy wrote:
I am not sure I really understand all this and I would certainly like it to be explained in plain simple terms.


Note the "partial" keyword above in the class declaration. Declaring a class as partial allows you to split its declaration across several code files. This helps segragate parts of a class so that a single code file doesn't become so large as to be unmanageable.

For example, when Visual Studio generates code for a Form class, it seperates the code for initializing the controls on the Form in a second code file. This initialization code can be quite verbose, and it helps to have it in its own code file instead of poluting the one in which you'll be writing your own code.

So since Visual Studio declared the MainForm class as partial, and since you changed the name of your extension class to MainForm, the code that was in the extension class is now considered part of the MainForm class. So you can call the getYMDHMS method directly from MainForm.
GeneralRe: using separate codefiles Pin
Glen Harvy8-Aug-06 21:21
Glen Harvy8-Aug-06 21:21 
AnswerRe: using separate codefiles Pin
Nader Elshehabi8-Aug-06 18:45
Nader Elshehabi8-Aug-06 18:45 
QuestionerrorProvider problem [modified] Pin
dustin108-Aug-06 13:25
dustin108-Aug-06 13:25 
AnswerRe: errorProvider problem Pin
stancrm8-Aug-06 22:14
stancrm8-Aug-06 22:14 
QuestionColor deviation algorithm... Pin
Shy Agam8-Aug-06 12:54
Shy Agam8-Aug-06 12:54 
QuestionExplorer bar type applications Pin
martin_hughes8-Aug-06 12:17
martin_hughes8-Aug-06 12:17 
QuestionCustom type casting Pin
Master Toothless One8-Aug-06 11:04
Master Toothless One8-Aug-06 11:04 
AnswerRe: Custom type casting Pin
led mike8-Aug-06 11:08
led mike8-Aug-06 11:08 
AnswerRe: Custom type casting [modified] Pin
Patricker8-Aug-06 12:00
Patricker8-Aug-06 12:00 
GeneralRe: Custom type casting Pin
Master Toothless One8-Aug-06 13:06
Master Toothless One8-Aug-06 13:06 
GeneralRe: Custom type casting Pin
Patricker8-Aug-06 13:44
Patricker8-Aug-06 13:44 
GeneralRe: Custom type casting [modified] Pin
Master Toothless One8-Aug-06 14:05
Master Toothless One8-Aug-06 14:05 
QuestionDatagrid column headers Pin
Naji.A8-Aug-06 9:51
Naji.A8-Aug-06 9:51 
AnswerRe: Datagrid column headers Pin
_AK_8-Aug-06 18:33
_AK_8-Aug-06 18:33 
GeneralRe: Datagrid column headers Pin
Naji.A9-Aug-06 16:26
Naji.A9-Aug-06 16:26 
Questionauto comboBox Pin
TAREQ F ABUZUHRI8-Aug-06 9:15
TAREQ F ABUZUHRI8-Aug-06 9:15 
AnswerRe: auto comboBox Pin
stancrm8-Aug-06 9:56
stancrm8-Aug-06 9:56 

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.