Click here to Skip to main content
15,898,371 members
Home / Discussions / C#
   

C#

 
QuestionISO 8583 Pin
Tiger4568-Aug-06 14:53
Tiger4568-Aug-06 14:53 
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 
Leslie Sanford wrote:
Does this example help?


Are you kidding - without your help I would still be lost Big Grin | :-D .


Leslie Sanford wrote:
do you mean that you can't use the class that contains the method in one file in another file?


Yes - that's exactly what I mean BUT I can only say that AFTER I studied your response and then looked up the next error message and discovered the importance of the "static method" located at http://www.vijaymukhi.com/documents/books/csbasics/chap3.htm[^] .

Here's the top part of my "extension.cs" file that I created after following your instructions:

namespace myclubv2<br />
{<br />
  class extension<br />
  {<br />
    public string getYMDHMS()<br />
    {<br />
      string YMDHMS;<br />
      YMDHMS = Convert.ToString(DateTime.Now.Year);<br />
<br />
      string sMonth = "";<br />
      int Month = DateTime.Now.Month;<br />
      if (Month < 10)<br />
      {<br />
        sMonth = "0";<br />
        sMonth += Convert.ToString(DateTime.Now.Month);<br />
      }<br />
      else



and my "mainform.cs" file:

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


Now - the above works but I also note that making the namespace AND the class the same in both files I can do away with the following :


<br />
      extension a;<br />
      a = new extension();<br />
      string ext = (string) a.getYMDHMS();<br />


and just use getYMDHMS();

in my "mainform.cs" file.

I am not sure I really understand all this and I would certainly like it to be explained in plain simple terms. I understood what you told me (I think Smile | :) ) but whilst this may be all simple to most - to a beginner I believe that it deserves an article by itself.

Thanks for your response.

Warm regards,



Glen Harvy

GeneralRe: using separate codefiles Pin
Leslie Sanford8-Aug-06 19:05
Leslie Sanford8-Aug-06 19:05 
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 

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.