Click here to Skip to main content
15,845,785 members
Home / Discussions / C#
   

C#

 
QuestionHow to insert the XML file in SQL Server Pin
Jieha Lee19-Jan-18 5:23
Jieha Lee19-Jan-18 5:23 
AnswerRe: How to insert the XML file in SQL Server Pin
OriginalGriff19-Jan-18 5:58
mveOriginalGriff19-Jan-18 5:58 
AnswerRe: How to insert the XML file in SQL Server Pin
jschell20-Jan-18 6:54
jschell20-Jan-18 6:54 
GeneralRe: How to insert the XML file in SQL Server Pin
Laxmidhar tatwa technologies23-Jan-18 6:00
Laxmidhar tatwa technologies23-Jan-18 6:00 
GeneralRe: How to insert the XML file in SQL Server Pin
jschell27-Jan-18 6:09
jschell27-Jan-18 6:09 
QuestionCalling a Method from a Form event Pin
ormonds18-Jan-18 15:08
ormonds18-Jan-18 15:08 
AnswerRe: Calling a Method from a Form event Pin
User 740747018-Jan-18 15:35
User 740747018-Jan-18 15:35 
AnswerRe: Calling a Method from a Form event Pin
OriginalGriff18-Jan-18 21:07
mveOriginalGriff18-Jan-18 21:07 
Methods (and fields, properties and events) are part of the class definition: So when you add a method to ClassA, it doesn't exist as part of ClassB. So to access a ClassA method from ClassB, you have to specify which class you are referring to; which class the system should look at - either by specifying a class instance:
C#
Button b = new Button();
b.Text = "Click me!";
Or (in the case of static methods like MyMethod) by specifying the class name:
C#
Program.MyMethod(currentfile, TargetFile);

But you shouldn't really be modifying the Program.cs file - instead add a Utilities.cs file, and create a static class in that. To DO that, right click your project name in the Solution Explorer pane, and select "Add"..."Class...". Change the name from "Class1" to "Utilities" and click the "Add" button.
Change the class to static and add your method to that. Then when you write your code, it's a bit more obvious that these are designed as "generic helper" methods:
C#
Utilities.MyMethod(currentfile, TargetFile);

Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

AnswerRe: Calling a Method from a Form event Pin
ormonds19-Jan-18 18:00
ormonds19-Jan-18 18:00 
GeneralRe: Calling a Method from a Form event Pin
OriginalGriff19-Jan-18 21:34
mveOriginalGriff19-Jan-18 21:34 
QuestionWhy ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Member 1228884018-Jan-18 9:18
Member 1228884018-Jan-18 9:18 
AnswerRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Richard MacCutchan18-Jan-18 22:10
mveRichard MacCutchan18-Jan-18 22:10 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Member 1228884019-Jan-18 8:44
Member 1228884019-Jan-18 8:44 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Richard MacCutchan19-Jan-18 9:01
mveRichard MacCutchan19-Jan-18 9:01 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Member 1228884019-Jan-18 12:30
Member 1228884019-Jan-18 12:30 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Pete O'Hanlon19-Jan-18 23:22
subeditorPete O'Hanlon19-Jan-18 23:22 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Member 1228884020-Jan-18 7:59
Member 1228884020-Jan-18 7:59 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Pete O'Hanlon20-Jan-18 23:27
subeditorPete O'Hanlon20-Jan-18 23:27 
QuestionProject Reference Installed Applications Pin
TheCoolTech18-Jan-18 6:32
TheCoolTech18-Jan-18 6:32 
AnswerRe: Project Reference Installed Applications Pin
OriginalGriff18-Jan-18 6:48
mveOriginalGriff18-Jan-18 6:48 
AnswerRe: Project Reference Installed Applications Pin
Richard MacCutchan18-Jan-18 7:40
mveRichard MacCutchan18-Jan-18 7:40 
QuestionCannot convert from ref decimal? to ref decimal Pin
Kevin Marois18-Jan-18 6:30
professionalKevin Marois18-Jan-18 6:30 
AnswerRe: Cannot convert from ref decimal? to ref decimal Pin
F-ES Sitecore18-Jan-18 7:12
professionalF-ES Sitecore18-Jan-18 7:12 
GeneralRe: Cannot convert from ref decimal? to ref decimal Pin
Kevin Marois18-Jan-18 7:23
professionalKevin Marois18-Jan-18 7:23 
AnswerRe: Cannot convert from ref decimal? to ref decimal Pin
Gerry Schmitz19-Jan-18 8:38
mveGerry Schmitz19-Jan-18 8:38 

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.